I want to know whether I can assign a subclass reference to a
referencefield to the constructor of which the base class has been
passed. For example:
class Base(Document):
str1=StringField(max_length=50)
class Derived(Base):
str2=StringField(max_length=50)
class Container(Document):
r=ReferenceField(Base)
d=Derived(str1="str1",str2="str2")
c=Container()
c.r=d
Is the line c.r=d valid?
Or do I need to use a GenericReferenceField?
Got the answer at the mongoengine google group. It is valid to do so.
http://groups.google.com/group/mongoengine-users/browse_thread/thread/324c2d58876708fa