summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2012-09-19 07:13:10 -0400
committerTim Graham <timograham@gmail.com>2012-09-19 15:09:49 -0400
commit1360bd4186239d7e4c4481b7d6a1a650fe69d12f (patch)
tree2417932136ec3b0c58fe6dd5d5f3f75b18ff0e36 /docs/ref
parent4e9a74b81df1c7aaea2f90a3a4911920e134b275 (diff)
Fixed #13586 - Added an example of how to connect a m2m_changed signal handler.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/signals.txt13
1 files changed, 11 insertions, 2 deletions
diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt
index b2f2e85abc..4b463e03ea 100644
--- a/docs/ref/signals.txt
+++ b/docs/ref/signals.txt
@@ -287,13 +287,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