Update signals doc - clarification on EmbeddedDocument
Since there is a .save() method on EmbeddedDocument, you could be tempted to attach a pre_save event to an EmbeddedDocument (#1720). This update is an attempt to make this clearer.
This commit is contained in:
parent
a0e5cf4ecc
commit
1a2b1f283b
@ -113,6 +113,10 @@ handlers within your subclass::
|
|||||||
signals.pre_save.connect(Author.pre_save, sender=Author)
|
signals.pre_save.connect(Author.pre_save, sender=Author)
|
||||||
signals.post_save.connect(Author.post_save, sender=Author)
|
signals.post_save.connect(Author.post_save, sender=Author)
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Note that EmbeddedDocument only supports pre/post_init signals. pre/post_save, etc should be attached to Document's class only. Attaching pre_save to an EmbeddedDocument is ignored silently.
|
||||||
|
|
||||||
Finally, you can also use this small decorator to quickly create a number of
|
Finally, you can also use this small decorator to quickly create a number of
|
||||||
signals and attach them to your :class:`~mongoengine.Document` or
|
signals and attach them to your :class:`~mongoengine.Document` or
|
||||||
:class:`~mongoengine.EmbeddedDocument` subclasses as class decorators::
|
:class:`~mongoengine.EmbeddedDocument` subclasses as class decorators::
|
||||||
|
Loading…
x
Reference in New Issue
Block a user