mirror of
				https://gitlab.com/animath/si/plateforme-corres2math.git
				synced 2025-11-04 10:22:15 +01:00 
			
		
		
		
	Delete related videos when a participation got deleted
This commit is contained in:
		@@ -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):
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user