diff --git a/core/models.py b/core/models.py index 610c323..e48c39d 100644 --- a/core/models.py +++ b/core/models.py @@ -391,6 +391,7 @@ class Meta: from django.dispatch import receiver from django.core.exceptions import ValidationError + @receiver(m2m_changed, sender=Team.members.through) def team_m2m_clean(sender, instance, action, **kwargs): if action == "post_clear": @@ -402,4 +403,3 @@ def team_m2m_clean(sender, instance, action, **kwargs): if instance.is_empty(): print("Deleting empty team: ", instance.name) instance.delete() -