If I have two models, User
and Address
, and they reference each other like this:
# usermodel.py
from address import Address
from mongoengine import *
class User(Document):
name = StringField()
address = ReferenceField(Address)
# address.py
from mongoengine import *
class Address(Document):
owner = ReferenceField('User', reverse_delete_rule=2)
I get the error message:
NotRegistered('`User` has not been registered in the document registry.
Importing the document class automatically registers it, has it been imported?',)
Can I set up a signal on one document and a reverse_delete_rule on another? I believe this is happening because reverse_delete_rule needs to register the document.