Inconsistent setting of '_cls' broke inherited document referencing

Fixes #199
This commit is contained in:
Ross Lawley
2011-06-15 16:51:49 +01:00
parent 967e72723b
commit 658b85d327
4 changed files with 61 additions and 12 deletions

View File

@@ -652,7 +652,7 @@ class GenericReferenceField(BaseField):
id_ = id_field.to_mongo(id_)
collection = document._meta['collection']
ref = pymongo.dbref.DBRef(collection, id_)
return {'_cls': document.__class__.__name__, '_ref': ref}
return {'_cls': document._class_name, '_ref': ref}
def prepare_query_value(self, op, value):
return self.to_mongo(value)