mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 07:02:10 +01:00 
			
		
		
		
	Display pending validations for organizers
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
		@@ -428,6 +428,41 @@ class VolunteerRegistration(Registration):
 | 
			
		||||
        from registration.forms import VolunteerRegistrationForm
 | 
			
		||||
        return VolunteerRegistrationForm
 | 
			
		||||
 | 
			
		||||
    def important_informations(self):
 | 
			
		||||
        informations = []
 | 
			
		||||
 | 
			
		||||
        for tournament in self.organized_tournaments.all():
 | 
			
		||||
            if timezone.now() < tournament.inscription_limit \
 | 
			
		||||
                    or tournament.participations.filter(valid=True).count() < tournament.max_teams:
 | 
			
		||||
                text = _("Registrations for tournament {tournament} are closing on {date:%Y-%m-%d %H:%M}. "
 | 
			
		||||
                         "There are for now {validated_teams} validated teams (+ {pending_teams} pending) "
 | 
			
		||||
                         "on {max_teams} expected.")
 | 
			
		||||
                content = format_lazy(text, tournament=tournament.name, date=tournament.inscription_limit,
 | 
			
		||||
                                      validated_teams=tournament.participations.filter(valid=True).count(),
 | 
			
		||||
                                      pending_teams=tournament.participations.filter(valid=False).count(),
 | 
			
		||||
                                      max_teams=tournament.max_teams)
 | 
			
		||||
                informations.append({
 | 
			
		||||
                    'title': _("Registrations"),
 | 
			
		||||
                    'type': "info",
 | 
			
		||||
                    'priority': 2,
 | 
			
		||||
                    'content': content,
 | 
			
		||||
                })
 | 
			
		||||
 | 
			
		||||
            for pending_participation in tournament.participations.filter(valid=False).all():
 | 
			
		||||
                text = _("The team {trigram} requested to be validated for the tournament of {tournament}. "
 | 
			
		||||
                         "You can check the status of the team on the <a href=\"{url}\">team page</a>.")
 | 
			
		||||
                url = reverse_lazy("participation:team_detail", args=(pending_participation.team.id,))
 | 
			
		||||
                content = format_lazy(text, trigram=pending_participation.team.trigram,
 | 
			
		||||
                                      tournament=tournament.name, url=url)
 | 
			
		||||
                informations.append({
 | 
			
		||||
                    'title': _("Pending validation"),
 | 
			
		||||
                    'type': "warning",
 | 
			
		||||
                    'priority': 4,
 | 
			
		||||
                    'content': content,
 | 
			
		||||
                })
 | 
			
		||||
 | 
			
		||||
        return informations
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        verbose_name = _("volunteer registration")
 | 
			
		||||
        verbose_name_plural = _("volunteer registrations")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user