I know we can put single quoted class name there when the class has not yet defined.

from_user = ReferenceField('User')

However, we got a problem here. Seems like in runtime it interprets our class as mongoengine.django.auth.user instead of our custom user class. (This is just what I guess but in runtime during debug mode I find that it misinterprets it as mongoengine.django.auth.user although the record in the collections should belong to the custom user class)

So is there any way for me to specify a fully qualified class name there?

Okay after I have reversed the order then it works!! So I define User class first and then Notification class. So I can reference User class from the Notification class. But would still want to know if there is any way to specify a class with fully qualified name in python. thanks!
–
ChrisJan 23 '13 at 1:08

1 Answer
1

In this instance you'd need to declare the User class after the Notification class.

Internally mongoengine uses a class registry, which is populated via the Document metaclass. Unfortunately, namespacing isn't the same as in the java world (I never thought I'd say that!) so as far as I know its not possible to determine the full location name for a class eg: myapp.models.User

Are you using the django User class? as well as another User class - this will cause issues with the registry as currently you can only have one class per name.