Add custom club name field to Tournament model

main
Razmig Sarkissian 4 weeks ago
parent f152a441d4
commit 093015dac6
  1. 1
      tournaments/models/tournament.py
  2. 7
      tournaments/signals.py

@ -98,6 +98,7 @@ class Tournament(BaseModel):
currency_code = models.CharField(null=True, blank=True, max_length=3, default='EUR')
# parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.SET_NULL, related_name='children')
# loser_index = models.IntegerField(default=0)
custom_club_name = models.CharField(null=True, blank=True, max_length=100)
def delete_dependencies(self):
for team_registration in self.team_registrations.all():

@ -77,6 +77,13 @@ def unregister_team(sender, instance, **kwargs):
notify_team(instance, instance.tournament, TeamEmailType.UNREGISTERED)
teams = instance.tournament.teams(True)
# Check if the team being deleted is in the waiting list
team_being_deleted = next((team for team in teams if team.team_registration.id == instance.id), None)
is_team_in_waiting_list = team_being_deleted and team_being_deleted.team_registration.out_of_tournament() == True
# Only notify the first waiting list team if the deleted team is NOT in the waiting list
if not is_team_in_waiting_list:
first_waiting_list_team = instance.tournament.first_waiting_list_team(teams)
if first_waiting_list_team and first_waiting_list_team.id != instance.id:
if instance.tournament.automatic_waiting_list():

Loading…
Cancel
Save