summaryrefslogtreecommitdiff
path: root/docs
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 18:01:06 -0400
commit3a64adef611ba152eb96d77645480e1953825803 (patch)
treed959a569ad9a916db6c2283b85d4127124006188 /docs
parent336dfc3413b22bc5a5008bba7ff383886da96d60 (diff)
[1.4.X] Fixed #13586 - Added an example of how to connect a m2m_changed signal handler.
Backport of 1360bd4186 from master
Diffstat (limited to 'docs')
-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 3917b52b96..486e53b679 100644
--- a/docs/ref/signals.txt
+++ b/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