Why "m2m_changed" signals never gets fired from the admin site?
Well, dont know if this is a bug or if I've a concept error. But try to test it:
A simple generic test:
from django.dispatch import receiver
from django.db.models.signals import m2m_changed
@receiver(m2m_changed)
def test_handler(sender, instance, action, reverse, model, pk_set, **kwargs):
import sys
print>>sys.stde开发者_运维问答rr, action
Add this snippet to your code and try to edit a model from the admin that contains a m2m relation. You can add or delete an object to the relationship. Then, you will see that the signal doesn't fire: S
Instead, if you do the same from a shell ... everything works fine.
Could anyone try it and confirm it is not a paranormal activity at my computer?
Thanks in advance.
I tried it on one of my models it was working perfectly. It would me much useful if you post all the contents of the model file code.
精彩评论