Merge pull request #1016 from bigblind/patch-2

Solution for documentation issue #1003
This commit is contained in:
Matthieu Rigal 2015-06-11 14:40:41 +02:00
commit dba4c33c81

View File

@ -315,12 +315,12 @@ reference with a delete rule specification. A delete rule is specified by
supplying the :attr:`reverse_delete_rule` attributes on the supplying the :attr:`reverse_delete_rule` attributes on the
:class:`ReferenceField` definition, like this:: :class:`ReferenceField` definition, like this::
class Employee(Document): class ProfilePage(Document):
... ...
profile_page = ReferenceField('ProfilePage', reverse_delete_rule=mongoengine.NULLIFY) employee = ReferenceField('Employee', reverse_delete_rule=mongoengine.CASCADE)
The declaration in this example means that when an :class:`Employee` object is The declaration in this example means that when an :class:`Employee` object is
removed, the :class:`ProfilePage` that belongs to that employee is removed as removed, the :class:`ProfilePage` that references that employee is removed as
well. If a whole batch of employees is removed, all profile pages that are well. If a whole batch of employees is removed, all profile pages that are
linked are removed as well. linked are removed as well.