1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 02:06:52 +00:00

Delete related videos when a participation got deleted

This commit is contained in:
Yohann D'ANELLO 2020-10-15 17:20:58 +02:00
parent 9e097c99d0
commit df74f499ec
2 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.db.models.signals import post_save, pre_save
from django.db.models.signals import post_save, pre_delete, pre_save
class ParticipationConfig(AppConfig):

View File

@ -23,3 +23,10 @@ def update_mailing_list(instance: Team, **_):
for coach in instance.coachs.all():
get_sympa_client().subscribe(coach.user.email, f"equipe-{instance.trigram.lower()}", False,
f"{coach.user.first_name} {coach.user.last_name}")
def delete_related_videos(instance: Participation, **_):
if instance.solution:
instance.solution.delete()
if instance.synthesis:
instance.synthesis.delete()