Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.4.X] Fixed #13586 - Added an example of how to connect a m2m_chang…

…ed signal handler.

Backport of 1360bd4 from master
  • Loading branch information...
commit 3a64adef611ba152eb96d77645480e1953825803 1 parent 336dfc3
@timgraham timgraham authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 docs/ref/signals.txt
View
13 docs/ref/signals.txt
@@ -277,13 +277,22 @@ like this::
# ...
toppings = models.ManyToManyField(Topping)
-If we would do something like this:
+If we connected a handler like this::
+
+ def toppings_changed(sender, **kwargs):
+ # Do something
+ pass
+
+ m2m_changed.connect(toppings_changed, sender=Pizza.toppings.through)
+
+and then did something like this::
>>> p = Pizza.object.create(...)
>>> t = Topping.objects.create(...)
>>> p.toppings.add(t)
-the arguments sent to a :data:`m2m_changed` handler would be:
+the arguments sent to a :data:`m2m_changed` handler (``topppings_changed`` in
+the example above) would be:
============== ============================================================
Argument Value
Please sign in to comment.
Something went wrong with that request. Please try again.