post_remove シグナルを検出する必要があるため、次のように記述しました。
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)
'post_add' で 'post_remove' を変更すれば問題ありません.. post_remove に関する Django のバグですか??
私はそのモデルを使用し、「購読済み」の 2 つの値を切り替えます (つまり、1 つが追加され、1 つが削除されます)。
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'})
django のバグを含む投稿を見たことがありますが、修正されていない可能性があります... (またはそれは私です ^^)