m2m_changed signal doesn't call receiver
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2-beta|
|Severity:||Keywords:||m2m_save, dispatch, signal|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
For some reason or another the m2m_changed signal does not call the receiver.
A rough models.py similar to my code:
class SomeContent(models.Model): sites = models.ForeignKey(Site) def m2m_handler(sender, instance, action, reverse, model, pk_set, **kwargs): raise NotImplementedError models.signals.m2m_changed.connect(m2m_handler, SomeContent) >>> sc = SomeContent() >>> sc.save() >>> sc.sites.add(Site.objects.get_current()) # Here you would expect a "NotImplementedError" >>>
It seems the signal loses all receivers in
django.dispatch.dispatcher.Signal._line_receivers line 215.