mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-10-31 23:04:30 +01:00 
			
		
		
		
	Clôture des listes Sympa
This commit is contained in:
		
							
								
								
									
										28
									
								
								participation/management/commands/delete_old_sympa_lists.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								participation/management/commands/delete_old_sympa_lists.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| # Copyright (C) 2025 by Animath | ||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||
| from django.conf import settings | ||||
| from django.core.management import BaseCommand | ||||
| from django.db.models import Q | ||||
| from django.template.defaultfilters import slugify | ||||
| from participation.models import Team, Tournament | ||||
| from registration.models import ParticipantRegistration, VolunteerRegistration | ||||
| from tfjm.lists import get_sympa_client | ||||
|  | ||||
|  | ||||
| class Command(BaseCommand): | ||||
|     def handle(self, *args, **options): | ||||
|         """ | ||||
|         Supprime les listes de diffusion Sympa. | ||||
|         Toutes les listess commençant par "equipe", "orga" ou "jury" sont fermées. | ||||
|         Attention : la fermeture n'est pas définitive, il faut ensuite se rendre sur Sympa | ||||
|         pour supprimer les listes fermées. | ||||
|         """ | ||||
|         if not settings.ML_MANAGEMENT: | ||||
|             return | ||||
|  | ||||
|         sympa = get_sympa_client() | ||||
|  | ||||
|     for mailing_list in sympa.all_lists(): | ||||
|         address = mailing_list.list_address | ||||
|         if address.startswith("equipe") or address.startswith("orga") or address.startswith("jury"): | ||||
|             sympa.delete_list(address) | ||||
		Reference in New Issue
	
	Block a user