feat: fixed review not adding if reviewer added after creating

This commit is contained in:
Андрей Сумин
2025-03-02 17:41:56 +03:00
parent 38fa8a54fb
commit 52cb8f72ce
3 changed files with 18 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
# myapp/signals.py
from django.db.models.signals import m2m_changed
from django.dispatch import receiver
from apps.review.models import Review
from apps.task.models import CompetitionTask, CompetitionTaskSubmission
@receiver(m2m_changed, sender=CompetitionTask.reviewers.through)
def print_reviewers(sender, instance, action, **kwargs):
if action in ['post_add', 'post_remove', 'post_clear']:
submissions = CompetitionTaskSubmission.objects.filter(task=instance)
for submission in submissions:
submission.send_on_review()