I need to detect a post_remove signal, so I have written :
def handler1(sender, instance, action, reverse, model, pk_set, **kwargs):
if (action == 'post_remove'):
test1() # not declared but make a bug if it works, to detect :)
m2m_changed.connect(handler1, sender=Course.subscribed.through)
If I change 'post_remove' by 'post_add' it is ok.. Is it a django's bug about post_remove ??
I use that model and I switch beetween two values of 'subscribed' (so one added and one deleted)
class Course(models.Model):
name = models.CharField(max_length=30)
subscribed = models.ManyToManyField(User, related_name='course_list', blank=True, null=True, limit_choices_to={'userprofile__status': 'student'})
I have seen a post with a bug of django, maybe it havn't been fixed... (or it's me ^^)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…