Django

Code

Ticket #5390: m2msignals_doc.txt

File m2msignals_doc.txt, 1.0 kB (added by ludo@qix.it, 2 years ago)

patch for the db-api docs

Line 
1 Index: docs/db-api.txt
2 ===================================================================
3 --- docs/db-api.txt     (revision 7028)
4 +++ docs/db-api.txt     (working copy)
5 @@ -225,6 +225,19 @@
6  
7  Django will complain if you try to assign or add an object of the wrong type.
8  
9 +When you update a ``ManyToManyField``, Django will emit a signal that
10 +provides a notification of the changes. The raised signals are:
11 +
12 +    * **``m2m_add_items``** gets fired after new objects are added to the
13 +      ``ManyToManyField``, and passes the list of newly added objects to
14 +      listeners
15 +    * **``m2m_remove_items``** gets fired after existing objects are removed
16 +      from the ``ManyToManyField``, and passes a list of removed objects
17 +      to listeners
18 +    * **``m2m_clear_items``** gets fired before all objects are cleared
19 +      from the ``ManyToManyField``, and passes a list of the objects to be
20 +      removed to listeners
21 +
22  How Django knows to UPDATE vs. INSERT
23  -------------------------------------
24