mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 19:07:10 +00:00
14 lines
519 B
Python
14 lines
519 B
Python
# myapp/signals.py
|
|
from django.db.models.signals import m2m_changed
|
|
from django.dispatch import receiver
|
|
|
|
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()
|