diff --git a/draw/admin.py b/draw/admin.py index 4d4b9e5..9d80bc7 100644 --- a/draw/admin.py +++ b/draw/admin.py @@ -7,11 +7,34 @@ from django.utils.translation import gettext_lazy as _ from .models import Draw, Pool, Round, TeamDraw +class RoundInline(admin.TabularInline): + model = Round + extra = 0 + autocomplete_fields = ('draw', 'current_pool',) + show_change_link = True + + +class PoolInline(admin.TabularInline): + model = Pool + extra = 0 + autocomplete_fields = ('round', 'current_team', 'associated_pool',) + show_change_link = True + + +class TeamDrawInline(admin.TabularInline): + model = TeamDraw + extra = 0 + autocomplete_fields = ('participation', 'round', 'pool',) + show_change_link = True + + @admin.register(Draw) class DrawAdmin(admin.ModelAdmin): list_display = ('tournament', 'teams', 'current_round', 'get_state',) - list_filter = ('tournament', 'current_round',) + list_filter = ('tournament', 'current_round__number',) search_fields = ('tournament__name', 'tournament__participation__team__trigram',) + autocomplete_fields = ('tournament',) + inlines = (RoundInline,) @admin.display(description=_("teams")) def teams(self, record: Draw): @@ -20,10 +43,16 @@ class DrawAdmin(admin.ModelAdmin): @admin.register(Round) class RoundAdmin(admin.ModelAdmin): - list_display = ('draw', 'number', 'teams',) + list_display = ('draw', 'tournament', 'number', 'teams',) list_filter = ('draw__tournament', 'number',) search_fields = ('draw__tournament__name', 'pool__teamdraw__participation__team__trigram') ordering = ('draw__tournament__name', 'number') + autocomplete_fields = ('draw', 'current_pool',) + inlines = (PoolInline,) + + @admin.display(description=_("tournament"), ordering='draw__tournament__name') + def tournament(self, record): + return record.draw.tournament @admin.display(description=_("teams")) def teams(self, record: Round): @@ -36,6 +65,8 @@ class PoolAdmin(admin.ModelAdmin): list_filter = ('round__draw__tournament', 'round__number', 'letter') ordering = ('round__draw__tournament__name', 'round', 'letter') search_fields = ('round__draw__tournament__name', 'teamdraw__participation__team__trigram',) + autocomplete_fields = ('round', 'current_team', 'associated_pool',) + inlines = (TeamDrawInline,) @admin.display(ordering='round__draw__tournament__name', description=_("tournament")) def tournament(self, record): @@ -52,6 +83,7 @@ class TeamDrawAdmin(admin.ModelAdmin): 'passage_index', 'choose_index', 'passage_dice', 'choice_dice',) list_filter = ('round__draw__tournament', 'round__number', 'pool__letter',) search_fields = ('round__draw__tournament__name', 'participation__team__trigram',) + autocomplete_fields = ('participation', 'round', 'pool',) @admin.display(ordering='round__draw__tournament__name', description=_("tournament")) def tournament(self, record): diff --git a/draw/models.py b/draw/models.py index 8931d0a..7737f78 100644 --- a/draw/models.py +++ b/draw/models.py @@ -89,6 +89,7 @@ class Draw(models.Model): return 'WAITING_DRAW_PROBLEM' else: return 'WAITING_CHOOSE_PROBLEM' + get_state.short_description = _('State') @property def information(self): diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 4963f27..b36e212 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: TFJM\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-22 18:42+0100\n" +"POT-Creation-Date: 2024-02-23 21:43+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Emmy D'Anello \n" "Language-Team: LANGUAGE \n" @@ -21,20 +21,22 @@ msgstr "" msgid "API" msgstr "API" -#: draw/admin.py:16 draw/admin.py:28 draw/admin.py:44 participation/admin.py:44 -#: participation/models.py:250 participation/tables.py:87 +#: draw/admin.py:39 draw/admin.py:57 draw/admin.py:75 +#: participation/admin.py:109 participation/models.py:250 +#: participation/tables.py:87 msgid "teams" msgstr "équipes" -#: draw/admin.py:40 draw/admin.py:56 draw/models.py:24 -#: participation/admin.py:16 participation/admin.py:73 -#: participation/admin.py:104 participation/models.py:419 +#: draw/admin.py:53 draw/admin.py:71 draw/admin.py:88 draw/models.py:24 +#: participation/admin.py:79 participation/admin.py:140 +#: participation/admin.py:171 participation/models.py:419 #: participation/models.py:443 participation/models.py:513 +#: registration/models.py:601 #: registration/templates/registration/payment_form.html:51 msgid "tournament" msgstr "tournoi" -#: draw/admin.py:60 draw/models.py:231 draw/models.py:426 +#: draw/admin.py:92 draw/models.py:232 draw/models.py:427 #: participation/models.py:517 msgid "round" msgstr "tour" @@ -128,156 +130,160 @@ msgstr "dernier message" msgid "The last message that is displayed on the drawing interface." msgstr "Le dernier message qui est affiché sur l'interface de tirage." -#: draw/models.py:171 +#: draw/models.py:92 +msgid "State" +msgstr "État" + +#: draw/models.py:172 #, python-brace-format msgid "Draw of tournament {tournament}" msgstr "Tirage au sort du tournoi {tournament}" -#: draw/models.py:174 draw/models.py:186 +#: draw/models.py:175 draw/models.py:187 msgid "draw" msgstr "tirage au sort" -#: draw/models.py:175 +#: draw/models.py:176 msgid "draws" msgstr "tirages au sort" -#: draw/models.py:191 +#: draw/models.py:192 msgid "Round 1" msgstr "Tour 1" -#: draw/models.py:192 +#: draw/models.py:193 msgid "Round 2" msgstr "Tour 2" -#: draw/models.py:194 +#: draw/models.py:195 msgid "number" msgstr "numéro" -#: draw/models.py:195 +#: draw/models.py:196 msgid "The number of the round, 1 or 2" msgstr "Le numéro du tour, 1 ou 2" -#: draw/models.py:205 +#: draw/models.py:206 msgid "current pool" msgstr "poule actuelle" -#: draw/models.py:206 +#: draw/models.py:207 msgid "The current pool where teams select their problems." msgstr "La poule en cours, où les équipes choisissent leurs problèmes" -#: draw/models.py:232 +#: draw/models.py:233 msgid "rounds" msgstr "tours" -#: draw/models.py:254 participation/models.py:531 +#: draw/models.py:255 participation/models.py:531 msgid "letter" msgstr "lettre" -#: draw/models.py:255 +#: draw/models.py:256 msgid "The letter of the pool: A, B, C or D." msgstr "La lettre de la poule : A, B, C ou D." -#: draw/models.py:259 +#: draw/models.py:260 #: participation/templates/participation/tournament_detail.html:15 msgid "size" msgstr "taille" -#: draw/models.py:261 +#: draw/models.py:262 msgid "The number of teams in this pool, between 3 and 5." msgstr "Le nombre d'équipes dans la poule, entre 3 et 5." -#: draw/models.py:270 +#: draw/models.py:271 msgid "current team" msgstr "équipe actuelle" -#: draw/models.py:271 +#: draw/models.py:272 msgid "The current team that is selecting its problem." msgstr "L'équipe qui est en train de choisir son problème." -#: draw/models.py:280 +#: draw/models.py:281 msgid "associated pool" msgstr "poule associée" -#: draw/models.py:281 +#: draw/models.py:282 msgid "The full pool instance." msgstr "L'instance complète de la poule." -#: draw/models.py:404 +#: draw/models.py:405 #, python-brace-format msgid "Pool {letter}{number}" msgstr "Poule {letter}{number}" -#: draw/models.py:407 draw/models.py:434 participation/admin.py:69 -#: participation/admin.py:88 participation/models.py:583 +#: draw/models.py:408 draw/models.py:435 participation/admin.py:136 +#: participation/admin.py:155 participation/models.py:583 #: participation/models.py:592 participation/tables.py:83 msgid "pool" msgstr "poule" -#: draw/models.py:408 participation/models.py:584 +#: draw/models.py:409 participation/models.py:584 msgid "pools" msgstr "poules" -#: draw/models.py:420 participation/models.py:503 participation/models.py:753 +#: draw/models.py:421 participation/models.py:503 participation/models.py:753 #: participation/models.py:783 participation/models.py:821 msgid "participation" msgstr "participation" -#: draw/models.py:441 +#: draw/models.py:442 msgid "passage index" msgstr "numéro de passage" -#: draw/models.py:442 +#: draw/models.py:443 msgid "" "The passage order in the pool, between 0 and the size of the pool minus 1." msgstr "" "L'ordre de passage dans la poule, de 0 à la taille de la poule moins 1." -#: draw/models.py:450 +#: draw/models.py:451 msgid "choose index" msgstr "numéro de choix" -#: draw/models.py:451 +#: draw/models.py:452 msgid "" "The choice order in the pool, between 0 and the size of the pool minus 1." msgstr "" "L'ordre de choix dans la poule, entre 0 et la taille de la poule moins 1." -#: draw/models.py:457 draw/models.py:480 participation/models.py:606 +#: draw/models.py:458 draw/models.py:481 participation/models.py:606 #: participation/models.py:790 #, python-brace-format msgid "Problem #{problem}" msgstr "Problème n°{problem}" -#: draw/models.py:461 +#: draw/models.py:462 msgid "accepted problem" msgstr "problème accepté" -#: draw/models.py:468 +#: draw/models.py:469 msgid "passage dice" msgstr "dé d'ordre de passage" -#: draw/models.py:475 +#: draw/models.py:476 msgid "choice dice" msgstr "dé d'ordre de choix" -#: draw/models.py:484 +#: draw/models.py:485 msgid "purposed problem" msgstr "problème proposé" -#: draw/models.py:489 +#: draw/models.py:490 msgid "rejected problems" msgstr "problèmes rejetés" -#: draw/models.py:518 +#: draw/models.py:519 #, python-brace-format msgid "Draw of the team {trigram} for the pool {letter}{number}" msgstr "Tirage de l'équipe {trigram} pour la poule {letter}{number}" -#: draw/models.py:524 +#: draw/models.py:525 msgid "team draw" msgstr "tirage d'équipe" -#: draw/models.py:525 +#: draw/models.py:526 msgid "team draws" msgstr "tirages d'équipe" @@ -325,9 +331,9 @@ msgstr "Exporter" msgid "Continue draw" msgstr "Continuer le tirage" -#: draw/templates/draw/tournament_content.html:216 participation/admin.py:100 +#: draw/templates/draw/tournament_content.html:216 participation/admin.py:167 #: participation/models.py:249 participation/models.py:434 -#: registration/models.py:156 +#: registration/models.py:157 registration/models.py:592 #: registration/templates/registration/payment_form.html:50 msgid "team" msgstr "équipe" @@ -379,7 +385,7 @@ msgstr "Vous n'êtes pas dans une équipe." msgid "Logs" msgstr "Logs" -#: logs/models.py:22 registration/models.py:33 +#: logs/models.py:22 registration/models.py:34 msgid "user" msgstr "utilisateur" @@ -440,30 +446,30 @@ msgstr "changelogs" msgid "Changelog of type \"{action}\" for model {model} at {timestamp}" msgstr "Changelog de type \"{action}\" pour le modèle {model} le {timestamp}" -#: participation/admin.py:20 participation/tables.py:43 +#: participation/admin.py:83 participation/tables.py:43 msgid "valid" msgstr "valide" -#: participation/admin.py:24 participation/models.py:455 +#: participation/admin.py:87 participation/models.py:455 msgid "selected for final" msgstr "sélectionnée pour la finale" -#: participation/admin.py:57 participation/admin.py:116 +#: participation/admin.py:124 participation/admin.py:183 #: participation/models.py:613 participation/tables.py:111 msgid "defender" msgstr "défenseur⋅se" -#: participation/admin.py:61 participation/models.py:620 +#: participation/admin.py:128 participation/models.py:620 #: participation/models.py:833 msgid "opponent" msgstr "opposant⋅e" -#: participation/admin.py:65 participation/models.py:627 +#: participation/admin.py:132 participation/models.py:627 #: participation/models.py:834 msgid "reporter" msgstr "rapporteur⋅e" -#: participation/admin.py:120 participation/models.py:788 +#: participation/admin.py:187 participation/models.py:788 msgid "problem" msgstr "numéro de problème" @@ -713,7 +719,7 @@ msgstr "" "L'équipe {trigram} n'a pas encore été validée par les organisateurices. " "Merci de patienter." -#: participation/models.py:193 registration/models.py:492 +#: participation/models.py:193 registration/models.py:493 msgid "Pending validation" msgstr "Validation en attente" @@ -788,7 +794,7 @@ msgstr "organisateur⋅rices" msgid "final" msgstr "finale" -#: participation/models.py:420 registration/admin.py:93 +#: participation/models.py:420 registration/admin.py:125 msgid "tournaments" msgstr "tournois" @@ -1452,7 +1458,7 @@ msgid "Payment of" msgstr "Paiement de" #: participation/templates/participation/team_detail.html:132 -#: registration/models.py:521 +#: registration/models.py:522 msgid "grouped" msgstr "groupé" @@ -1549,13 +1555,13 @@ msgstr "dates" #: participation/templates/participation/tournament_detail.html:28 #: registration/templates/registration/mails/payment_confirmation.html:31 -#: registration/templates/registration/mails/payment_confirmation.txt:15 +#: registration/templates/registration/mails/payment_confirmation.txt:14 msgid "From" msgstr "Du" #: participation/templates/participation/tournament_detail.html:28 #: registration/templates/registration/mails/payment_confirmation.html:31 -#: registration/templates/registration/mails/payment_confirmation.txt:15 +#: registration/templates/registration/mails/payment_confirmation.txt:14 msgid "to" msgstr "au" @@ -1792,20 +1798,33 @@ msgstr "Les notes ont bien été envoyées." msgid "You can't upload a synthesis after the deadline." msgstr "Vous ne pouvez pas envoyer de note de synthèse après la date limite." -#: registration/admin.py:21 registration/admin.py:37 registration/admin.py:53 -#: registration/admin.py:69 registration/admin.py:85 +#: registration/admin.py:53 registration/admin.py:69 registration/admin.py:85 +#: registration/admin.py:101 registration/admin.py:117 msgid "first name" msgstr "prénom" -#: registration/admin.py:25 registration/admin.py:41 registration/admin.py:57 -#: registration/admin.py:73 registration/admin.py:89 registration/tables.py:17 +#: registration/admin.py:57 registration/admin.py:73 registration/admin.py:89 +#: registration/admin.py:105 registration/admin.py:121 +#: registration/tables.py:17 msgid "last name" msgstr "nom de famille" -#: registration/admin.py:106 +#: registration/admin.py:140 msgid "concerned people" msgstr "personnes concernées" +#: registration/admin.py:144 +msgid "Mark as valid" +msgstr "Marquer comme valide" + +#: registration/admin.py:148 +msgid "Mark as pending" +msgstr "Marquer comme en attente" + +#: registration/admin.py:152 +msgid "Mark as invalid" +msgstr "Marquer comme invalide" + #: registration/forms.py:22 msgid "role" msgstr "rôle" @@ -1814,7 +1833,7 @@ msgstr "rôle" msgid "participant" msgstr "participant⋅e" -#: registration/forms.py:25 registration/models.py:426 +#: registration/forms.py:25 registration/models.py:427 msgid "coach" msgstr "encadrant⋅e" @@ -1826,20 +1845,20 @@ msgstr "En attente" msgid "You must upload your receipt." msgstr "Vous devez envoyer votre justificatif." -#: registration/models.py:38 +#: registration/models.py:39 msgid "Grant Animath to contact me in the future about other actions" msgstr "" "Autoriser Animath à me recontacter à l'avenir à propos d'autres actions" -#: registration/models.py:43 +#: registration/models.py:44 msgid "email confirmed" msgstr "email confirmé" -#: registration/models.py:51 +#: registration/models.py:52 msgid "Activate your TFJM² account" msgstr "Activez votre compte du TFJM²" -#: registration/models.py:108 +#: registration/models.py:109 #, python-brace-format msgid "" "Your email address is not validated. Please click on the link you received " @@ -1850,52 +1869,52 @@ msgstr "" "avez reçu par mail. Vous pouvez renvoyer un mail en cliquant sur ce lien." -#: registration/models.py:128 +#: registration/models.py:129 msgid "registration" msgstr "inscription" -#: registration/models.py:129 registration/models.py:517 +#: registration/models.py:130 registration/models.py:518 msgid "registrations" msgstr "inscriptions" -#: registration/models.py:161 +#: registration/models.py:162 msgid "gender" msgstr "genre" -#: registration/models.py:163 +#: registration/models.py:164 msgid "Female" msgstr "Femme" -#: registration/models.py:164 +#: registration/models.py:165 msgid "Male" msgstr "Homme" -#: registration/models.py:165 +#: registration/models.py:166 #: registration/templates/registration/payment_form.html:87 msgid "Other" msgstr "Autre" -#: registration/models.py:172 +#: registration/models.py:173 msgid "address" msgstr "adresse" -#: registration/models.py:176 +#: registration/models.py:177 msgid "zip code" msgstr "code postal" -#: registration/models.py:182 +#: registration/models.py:183 msgid "city" msgstr "ville" -#: registration/models.py:186 +#: registration/models.py:187 msgid "phone number" msgstr "numéro de téléphone" -#: registration/models.py:191 +#: registration/models.py:192 msgid "health issues" msgstr "problèmes de santé" -#: registration/models.py:193 +#: registration/models.py:194 msgid "" "You can indicate here your allergies or anything that is important to know " "for organizers." @@ -1903,11 +1922,11 @@ msgstr "" "Vous pouvez indiquer ici vos allergies ou n'importe quoi qui peut être bon à " "savoir pour les organisateur⋅rices." -#: registration/models.py:197 +#: registration/models.py:198 msgid "housing constraints" msgstr "contraintes de logement" -#: registration/models.py:199 +#: registration/models.py:200 msgid "" "You can fill in something here if you have any housing constraints, e.g. " "medical problems, scheduling issues, gender issues, or anything else you " @@ -1920,11 +1939,11 @@ msgstr "" "organisateur⋅rices. Laissez vide si vous n'avez rien de spécifique à " "déclarer." -#: registration/models.py:206 +#: registration/models.py:207 msgid "photo authorization" msgstr "autorisation de droit à l'image" -#: registration/models.py:235 +#: registration/models.py:236 #, python-brace-format msgid "" "You are not in a team. You can create one or ou rejoindre une équipe existante pour " "participer." -#: registration/models.py:241 +#: registration/models.py:242 msgid "No team" msgstr "Pas d'équipe" -#: registration/models.py:249 +#: registration/models.py:250 #, python-brace-format msgid "" "You have not uploaded your photo authorization. You can do it by clicking on " @@ -1947,71 +1966,71 @@ msgstr "" "Vous n'avez pas envoyé votre autorisation de droit à l'image. Vous pouvez le " "faire en cliquant sur ce lien." -#: registration/models.py:254 +#: registration/models.py:255 msgid "Photo authorization" msgstr "Autorisation de droit à l'image" -#: registration/models.py:265 +#: registration/models.py:266 msgid "participant registration" msgstr "inscription de participant⋅e" -#: registration/models.py:266 +#: registration/models.py:267 msgid "participant registrations" msgstr "inscriptions de participant⋅es" -#: registration/models.py:275 +#: registration/models.py:276 msgid "birth date" msgstr "date de naissance" -#: registration/models.py:281 +#: registration/models.py:282 msgid "12th grade" msgstr "Terminale" -#: registration/models.py:282 +#: registration/models.py:283 msgid "11th grade" msgstr "Première" -#: registration/models.py:283 +#: registration/models.py:284 msgid "10th grade or lower" msgstr "Seconde ou inférieur" -#: registration/models.py:285 +#: registration/models.py:286 msgid "student class" msgstr "classe" -#: registration/models.py:290 +#: registration/models.py:291 msgid "school" msgstr "école" -#: registration/models.py:295 +#: registration/models.py:296 msgid "responsible name" msgstr "nom d'un⋅e responsable légal⋅e" -#: registration/models.py:300 +#: registration/models.py:301 msgid "responsible phone number" msgstr "numéro de téléphone d'un⋅e responsable légal⋅e" -#: registration/models.py:305 +#: registration/models.py:306 msgid "responsible email address" msgstr "adresse e-mail d'un⋅e responsable légal⋅e" -#: registration/models.py:310 +#: registration/models.py:311 msgid "parental authorization" msgstr "autorisation parentale" -#: registration/models.py:317 +#: registration/models.py:318 msgid "health sheet" msgstr "fiche sanitaire" -#: registration/models.py:324 +#: registration/models.py:325 msgid "vaccine sheet" msgstr "carnet de vaccination" -#: registration/models.py:332 +#: registration/models.py:333 msgid "student" msgstr "élève" -#: registration/models.py:343 +#: registration/models.py:344 #, python-brace-format msgid "" "You have not uploaded your parental authorization. You can do it by clicking " @@ -2020,11 +2039,11 @@ msgstr "" "Vous n'avez pas envoyé votre autorisation parentale. Vous pouvez le faire en " "cliquant sur ce lien." -#: registration/models.py:348 +#: registration/models.py:349 msgid "Parental authorization" msgstr "Autorisation parentale" -#: registration/models.py:354 +#: registration/models.py:355 #, python-brace-format msgid "" "You have not uploaded your health sheet. You can do it by clicking on ce lien." -#: registration/models.py:359 +#: registration/models.py:360 msgid "Health sheet" msgstr "Fiche sanitaire" -#: registration/models.py:365 +#: registration/models.py:366 #, python-brace-format msgid "" "You have not uploaded your vaccine sheet. You can do it by clicking on ce lien." -#: registration/models.py:370 +#: registration/models.py:371 msgid "Vaccine sheet" msgstr "Carnet de vaccination" -#: registration/models.py:379 +#: registration/models.py:380 #, python-brace-format msgid "" "You have to pay {amount} € for your registration, or send a scholarship " @@ -2061,27 +2080,27 @@ msgstr "" "notification de bourse ou un justificatif de paiement. Vous pouvez le faire " "sur la page de paiement." -#: registration/models.py:385 registration/models.py:394 +#: registration/models.py:386 registration/models.py:395 msgid "Payment" msgstr "Paiement" -#: registration/models.py:391 +#: registration/models.py:392 msgid "Your payment is under approval." msgstr "Votre paiement est en cours de validation." -#: registration/models.py:403 +#: registration/models.py:404 msgid "student registration" msgstr "inscription d'élève" -#: registration/models.py:404 +#: registration/models.py:405 msgid "student registrations" msgstr "inscriptions d'élève" -#: registration/models.py:415 +#: registration/models.py:416 msgid "most recent degree in mathematics, computer science or physics" msgstr "Dernier diplôme obtenu en mathématiques, informatique ou physique" -#: registration/models.py:416 +#: registration/models.py:417 msgid "" "Your most recent degree in maths, computer science or physics, or your last " "entrance exam (CAPES, Agrégation,…)" @@ -2089,23 +2108,23 @@ msgstr "" "Votre dernier diplôme en mathématiques, informatique ou physique, ou votre " "dernier concours obtenu (CAPES, Agrégation, …)" -#: registration/models.py:421 registration/models.py:443 +#: registration/models.py:422 registration/models.py:444 msgid "professional activity" msgstr "activité professionnelle" -#: registration/models.py:434 +#: registration/models.py:435 msgid "coach registration" msgstr "inscription d'encadrant⋅e" -#: registration/models.py:435 +#: registration/models.py:436 msgid "coach registrations" msgstr "inscriptions d'encadrant⋅es" -#: registration/models.py:447 +#: registration/models.py:448 msgid "administrator" msgstr "administrateur⋅rice" -#: registration/models.py:448 +#: registration/models.py:449 msgid "" "An administrator has all rights. Please don't give this right to all juries " "and volunteers." @@ -2113,15 +2132,15 @@ msgstr "" "Un⋅e administrateur⋅rice a tous les droits. Merci de ne pas donner ce droit " "à toustes les juré⋅es et bénévoles." -#: registration/models.py:458 +#: registration/models.py:459 msgid "admin" msgstr "admin" -#: registration/models.py:458 +#: registration/models.py:459 msgid "volunteer" msgstr "bénévole" -#: registration/models.py:471 +#: registration/models.py:472 msgid "" "Registrations for tournament {tournament} are closing on {date:%Y-%m-%d %H:" "%M}. There are for now {validated_teams} validated teams (+ {pending_teams} " @@ -2131,11 +2150,11 @@ msgstr "" "%M}. Il y a pour l'instant {validated_teams} équipes validées (+ " "{pending_teams} en attente) sur {max_teams} attendues." -#: registration/models.py:479 +#: registration/models.py:480 msgid "Registrations" msgstr "Inscriptions" -#: registration/models.py:486 +#: registration/models.py:487 #, python-brace-format msgid "" "The team {trigram} requested to be validated for the tournament of " @@ -2146,15 +2165,15 @@ msgstr "" "Vous pouvez vérifier le statut de l'équipe sur la page de " "l'équipe." -#: registration/models.py:501 +#: registration/models.py:502 msgid "volunteer registration" msgstr "inscription de bénévole" -#: registration/models.py:502 +#: registration/models.py:503 msgid "volunteer registrations" msgstr "inscriptions de bénévoles" -#: registration/models.py:523 +#: registration/models.py:524 msgid "" "If set to true, then one payment is made for the full team, for example if " "the school pays for all." @@ -2162,92 +2181,100 @@ msgstr "" "Si vrai, alors un seul paiement est fait pour toute l'équipe, par exemple si " "le lycée paie pour tout le monde." -#: registration/models.py:528 +#: registration/models.py:529 msgid "total amount" msgstr "montant total" -#: registration/models.py:529 +#: registration/models.py:530 msgid "Corresponds to the total required amount to pay, in euros." msgstr "Correspond au montant total à payer, en euros." -#: registration/models.py:534 +#: registration/models.py:535 msgid "token" msgstr "jeton" -#: registration/models.py:537 +#: registration/models.py:538 msgid "A token to authorize external users to make this payment." msgstr "Un jeton pour autoriser des utilisateurs externes à faire ce paiement." -#: registration/models.py:541 +#: registration/models.py:542 msgid "for final tournament" msgstr "pour la finale" -#: registration/models.py:546 +#: registration/models.py:547 msgid "type" msgstr "type" -#: registration/models.py:549 +#: registration/models.py:550 msgid "No payment" msgstr "Pas de paiement" -#: registration/models.py:550 +#: registration/models.py:551 #: registration/templates/registration/payment_form.html:70 msgid "Credit card" msgstr "Carte bancaire" -#: registration/models.py:551 +#: registration/models.py:552 msgid "Scholarship" msgstr "Notification de bourse" -#: registration/models.py:552 +#: registration/models.py:553 #: registration/templates/registration/payment_form.html:75 msgid "Bank transfer" msgstr "Virement bancaire" -#: registration/models.py:553 +#: registration/models.py:554 msgid "Other (please indicate)" msgstr "Autre (veuillez spécifier)" -#: registration/models.py:554 +#: registration/models.py:555 msgid "The tournament is free" msgstr "Le tournoi est gratuit" -#: registration/models.py:561 +#: registration/models.py:562 msgid "Hello Asso checkout intent ID" msgstr "ID de l'intention de paiement Hello Asso" -#: registration/models.py:568 +#: registration/models.py:569 msgid "receipt" msgstr "justificatif" -#: registration/models.py:569 +#: registration/models.py:570 msgid "only if you have a scholarship or if you chose a bank transfer." msgstr "" "Nécessaire seulement si vous déclarez être boursièr⋅e ou si vous payez par " "virement bancaire." -#: registration/models.py:576 +#: registration/models.py:577 msgid "additional information" msgstr "informations additionnelles" -#: registration/models.py:577 +#: registration/models.py:578 msgid "To help us to find your payment." msgstr "Pour nous aider à retrouver votre paiement, si nécessaire." -#: registration/models.py:583 +#: registration/models.py:584 msgid "payment valid" msgstr "paiement valide" -#: registration/models.py:641 +#: registration/models.py:644 +msgid "Reminder for your payment" +msgstr "Rappel pour votre paiement" + +#: registration/models.py:655 +msgid "Payment confirmation" +msgstr "Confirmation de paiement" + +#: registration/models.py:677 #, python-brace-format msgid "Payment of {registrations}" msgstr "Paiements de {registrations}" -#: registration/models.py:644 +#: registration/models.py:680 msgid "payment" msgstr "paiement" -#: registration/models.py:645 +#: registration/models.py:681 msgid "payments" msgstr "paiements" @@ -2307,9 +2334,9 @@ msgstr "L'équipe du TFJM²" #: registration/templates/registration/mails/email_validation_email.html:12 #: registration/templates/registration/mails/email_validation_email.txt:3 #: registration/templates/registration/mails/payment_confirmation.html:12 -#: registration/templates/registration/mails/payment_confirmation.txt:3 +#: registration/templates/registration/mails/payment_confirmation.txt:2 #: registration/templates/registration/mails/payment_reminder.html:12 -#: registration/templates/registration/mails/payment_reminder.txt:3 +#: registration/templates/registration/mails/payment_reminder.txt:2 msgid "Hi" msgstr "Bonjour" @@ -2351,7 +2378,7 @@ msgstr "" "dans l'équipe %(team)s !" #: registration/templates/registration/mails/payment_confirmation.html:22 -#: registration/templates/registration/mails/payment_confirmation.txt:9 +#: registration/templates/registration/mails/payment_confirmation.txt:8 msgid "" "Your registration is now fully completed, and you can work on your solutions." msgstr "" @@ -2359,7 +2386,7 @@ msgstr "" "solutions." #: registration/templates/registration/mails/payment_confirmation.html:23 -#: registration/templates/registration/mails/payment_confirmation.txt:10 +#: registration/templates/registration/mails/payment_confirmation.txt:9 msgid "" "Be sure first that other members of your team also pay their registration." msgstr "" @@ -2367,27 +2394,27 @@ msgstr "" "leur inscription." #: registration/templates/registration/mails/payment_confirmation.html:27 -#: registration/templates/registration/mails/payment_confirmation.txt:12 +#: registration/templates/registration/mails/payment_confirmation.txt:11 msgid "As a reminder, here are the following important dates:" msgstr "Pour rappel, voici les dates importantes à venir :" #: registration/templates/registration/mails/payment_confirmation.html:29 -#: registration/templates/registration/mails/payment_confirmation.txt:13 +#: registration/templates/registration/mails/payment_confirmation.txt:12 msgid "Deadline to send the solutions:" msgstr "Date limite pour envoyer les solutions :" #: registration/templates/registration/mails/payment_confirmation.html:30 -#: registration/templates/registration/mails/payment_confirmation.txt:14 +#: registration/templates/registration/mails/payment_confirmation.txt:13 msgid "Problems draw:" msgstr "Tirage des problèmes :" #: registration/templates/registration/mails/payment_confirmation.html:31 -#: registration/templates/registration/mails/payment_confirmation.txt:15 +#: registration/templates/registration/mails/payment_confirmation.txt:14 msgid "Tournament dates:" msgstr "Dates du tournoi :" #: registration/templates/registration/mails/payment_confirmation.html:36 -#: registration/templates/registration/mails/payment_confirmation.txt:17 +#: registration/templates/registration/mails/payment_confirmation.txt:16 msgid "" "Please note that these dates may be subject to change. If your local " "organizers gave you different dates, trust them." @@ -2397,7 +2424,7 @@ msgstr "" "leur confiance." #: registration/templates/registration/mails/payment_confirmation.html:40 -#: registration/templates/registration/mails/payment_confirmation.txt:19 +#: registration/templates/registration/mails/payment_confirmation.txt:18 msgid "" "NB: This mail don't represent a payment receipt. The payer should receive a " "mail from Hello Asso. If it is not the case, please contact us if necessary" @@ -2406,7 +2433,7 @@ msgstr "" "a payé devrait recevoir un mail de Hello Asso. Si ce n'est pas le cas, merci " "de nous contacter si nécessaire." -#: registration/templates/registration/mails/payment_confirmation.txt:5 +#: registration/templates/registration/mails/payment_confirmation.txt:4 #, python-format msgid "" "We successfully received the payment of %(amount)s € for the TFJM² " @@ -2415,12 +2442,12 @@ msgstr "" "Nous avons bien reçu le paiement de %(amount)s € pour l'inscription au TFJM² " "dans l'équipe %(team)s pour le tournoi %(tournament)s !" -#: registration/templates/registration/mails/payment_confirmation.txt:22 +#: registration/templates/registration/mails/payment_confirmation.txt:21 msgid "The TFJM² team" msgstr "L'équipe du TFJM²" #: registration/templates/registration/mails/payment_reminder.html:16 -#: registration/templates/registration/mails/payment_reminder.txt:5 +#: registration/templates/registration/mails/payment_reminder.txt:4 #, python-format msgid "" "You are registered for the TFJM² of %(tournament)s. Your team %(team)s has " @@ -2432,13 +2459,13 @@ msgstr "" "le montant de %(amount)s €." #: registration/templates/registration/mails/payment_reminder.html:24 -#: registration/templates/registration/mails/payment_reminder.txt:11 +#: registration/templates/registration/mails/payment_reminder.txt:9 #: registration/templates/registration/payment_form.html:14 msgid "This price includes the registrations of all members of your team." msgstr "Ce prix inclut les inscriptions de tous les membres de votre équipe." #: registration/templates/registration/mails/payment_reminder.html:29 -#: registration/templates/registration/mails/payment_reminder.txt:14 +#: registration/templates/registration/mails/payment_reminder.txt:11 msgid "" "You can pay by credit card or by bank transfer. You can read full " "instructions on the payment page:" @@ -2447,7 +2474,7 @@ msgstr "" "lire les instructions complètes sur la page de paiement :" #: registration/templates/registration/mails/payment_reminder.html:39 -#: registration/templates/registration/mails/payment_reminder.txt:18 +#: registration/templates/registration/mails/payment_reminder.txt:15 msgid "" "If you have a scholarship, then the registration is free for you. You must " "then upload it on the payment page using the above link." @@ -2457,7 +2484,7 @@ msgstr "" "dessus." #: registration/templates/registration/mails/payment_reminder.html:43 -#: registration/templates/registration/mails/payment_reminder.txt:20 +#: registration/templates/registration/mails/payment_reminder.txt:17 msgid "" "It is also possible to allow an external person (your parents, your school, " "etc.) to pay for you with credit card. Instructions are also available on " @@ -2468,7 +2495,7 @@ msgstr "" "disponibles sur la page de paiement." #: registration/templates/registration/mails/payment_reminder.html:47 -#: registration/templates/registration/mails/payment_reminder.txt:22 +#: registration/templates/registration/mails/payment_reminder.txt:19 msgid "If you have any problem, feel free to contact us." msgstr "Si vous avez le moindre problème, n'hésitez pas à nous contacter." @@ -2944,7 +2971,7 @@ msgstr "" "Le paiement a été validé avec succès ! Votre inscription est désormais " "complète." -#: registration/views.py:630 +#: registration/views.py:631 msgid "" "Your payment is done! The validation of your payment may takes a few " "minutes, and will be automatically done. If it is not the case, please " @@ -2954,27 +2981,27 @@ msgstr "" "quelques minutes, et sera faite automatiquement. Si ce n'est pas le cas, " "merci de nous contacter." -#: registration/views.py:661 +#: registration/views.py:662 #, python-brace-format msgid "Photo authorization of {student}.{ext}" msgstr "Autorisation de droit à l'image de {student}.{ext}" -#: registration/views.py:685 +#: registration/views.py:686 #, python-brace-format msgid "Health sheet of {student}.{ext}" msgstr "Fiche sanitaire de {student}.{ext}" -#: registration/views.py:709 +#: registration/views.py:710 #, python-brace-format msgid "Vaccine sheet of {student}.{ext}" msgstr "Carnet de vaccination de {student}.{ext}" -#: registration/views.py:733 +#: registration/views.py:734 #, python-brace-format msgid "Parental authorization of {student}.{ext}" msgstr "Autorisation parentale de {student}.{ext}" -#: registration/views.py:756 +#: registration/views.py:757 #, python-brace-format msgid "Payment receipt of {user}.{ext}" msgstr "Justificatif de paiement de {user}.{ext}" diff --git a/participation/admin.py b/participation/admin.py index 510f027..579f727 100644 --- a/participation/admin.py +++ b/participation/admin.py @@ -7,11 +7,74 @@ from django.utils.translation import gettext_lazy as _ from .models import Note, Participation, Passage, Pool, Solution, Synthesis, Team, Tournament, Tweak +class ParticipationInline(admin.StackedInline): + model = Participation + extra = 0 + autocomplete_fields = ('team', 'tournament',) + show_change_link = True + + +class ParticipationTabularInline(admin.TabularInline): + model = Participation + extra = 0 + fields = ('team', 'valid', 'final',) + readonly_fields = ('team',) + ordering = ('final', 'valid', 'team__trigram',) + autocomplete_fields = ('tournament',) + show_change_link = True + + +class SolutionInline(admin.TabularInline): + model = Solution + extra = 0 + ordering = ('problem',) + autocomplete_fields = ('participation',) + show_change_link = True + + +class SynthesisInline(admin.TabularInline): + model = Synthesis + extra = 0 + ordering = ('passage__solution_number', 'type',) + autocomplete_fields = ('passage',) + show_change_link = True + + +class PoolInline(admin.TabularInline): + model = Pool + extra = 0 + autocomplete_fields = ('tournament', 'participations', 'juries',) + show_change_link = True + + +class PassageInline(admin.TabularInline): + model = Passage + extra = 0 + ordering = ('position',) + autocomplete_fields = ('defender', 'opponent', 'reporter', 'observer',) + show_change_link = True + + +class NoteInline(admin.TabularInline): + model = Note + extra = 0 + autocomplete_fields = ('jury',) + show_change_link = True + + +class TweakInline(admin.TabularInline): + model = Tweak + extra = 0 + autocomplete_fields = ('participation', 'pool',) + show_change_link = True + + @admin.register(Team) class TeamAdmin(admin.ModelAdmin): list_display = ('name', 'trigram', 'tournament', 'valid', 'final',) search_fields = ('name', 'trigram',) list_filter = ('participation__valid', 'participation__tournament', 'participation__final',) + inlines = (ParticipationInline,) @admin.display(description=_("tournament")) def tournament(self, record): @@ -32,6 +95,7 @@ class ParticipationAdmin(admin.ModelAdmin): search_fields = ('team__name', 'team__trigram',) list_filter = ('valid',) autocomplete_fields = ('team', 'tournament',) + inlines = (SolutionInline, SynthesisInline,) @admin.register(Pool) @@ -40,6 +104,7 @@ class PoolAdmin(admin.ModelAdmin): list_filter = ('tournament', 'round', 'letter',) search_fields = ('participations__team__name', 'participations__team__trigram',) autocomplete_fields = ('tournament', 'participations', 'juries',) + inlines = (PassageInline, TweakInline,) @admin.display(description=_("teams")) def teams(self, record: Pool): @@ -49,28 +114,30 @@ class PoolAdmin(admin.ModelAdmin): @admin.register(Passage) class PassageAdmin(admin.ModelAdmin): list_display = ('__str__', 'defender_trigram', 'solution_number', 'opponent_trigram', 'reporter_trigram', - 'pool_abbr', 'tournament') + 'pool_abbr', 'position', 'tournament') list_filter = ('pool__tournament', 'pool__round', 'pool__letter', 'solution_number',) search_fields = ('pool__participations__team__name', 'pool__participations__team__trigram',) + ordering = ('pool__tournament', 'pool__round', 'pool__letter', 'position',) autocomplete_fields = ('pool', 'defender', 'opponent', 'reporter', 'observer',) + inlines = (NoteInline,) - @admin.display(description=_("defender")) + @admin.display(description=_("defender"), ordering='defender__team__trigram') def defender_trigram(self, record: Passage): return record.defender.team.trigram - @admin.display(description=_("opponent")) + @admin.display(description=_("opponent"), ordering='opponent__team__trigram') def opponent_trigram(self, record: Passage): return record.opponent.team.trigram - @admin.display(description=_("reporter")) + @admin.display(description=_("reporter"), ordering='reporter__team__trigram') def reporter_trigram(self, record: Passage): return record.reporter.team.trigram - @admin.display(description=_("pool")) + @admin.display(description=_("pool"), ordering='pool__letter') def pool_abbr(self, record): return f"{record.pool.get_letter_display()}{record.pool.round}" - @admin.display(description=_("tournament")) + @admin.display(description=_("tournament"), ordering='pool__tournament__name') def tournament(self, record: Passage): return record.pool.tournament @@ -124,9 +191,11 @@ class SynthesisAdmin(admin.ModelAdmin): @admin.register(Tournament) class TournamentAdmin(admin.ModelAdmin): - list_display = ('name',) + list_display = ('name', 'date_start', 'date_end',) search_fields = ('name',) + ordering = ('date_start', 'name',) autocomplete_fields = ('organizers',) + inlines = (ParticipationTabularInline, PoolInline,) @admin.register(Tweak) diff --git a/registration/admin.py b/registration/admin.py index ec32bc3..d43c792 100644 --- a/registration/admin.py +++ b/registration/admin.py @@ -3,13 +3,45 @@ from django.contrib import admin from django.contrib.admin import ModelAdmin +from django.contrib.auth.admin import UserAdmin +from django.contrib.auth.models import User from django.utils.translation import gettext_lazy as _ -from polymorphic.admin import PolymorphicChildModelAdmin, PolymorphicChildModelFilter, PolymorphicParentModelAdmin +from polymorphic.admin import PolymorphicChildModelAdmin, PolymorphicChildModelFilter, PolymorphicParentModelAdmin, \ + PolymorphicInlineSupportMixin, StackedPolymorphicInline from .models import CoachRegistration, ParticipantRegistration, Payment, Registration, \ StudentRegistration, VolunteerRegistration +class RegistrationInline(StackedPolymorphicInline): + class StudentRegistrationInline(StackedPolymorphicInline.Child): + model = StudentRegistration + autocomplete_fields = ('team',) + show_change_link = True + + class CoachRegistrationInline(StackedPolymorphicInline.Child): + model = CoachRegistration + autocomplete_fields = ('team',) + show_change_link = True + + class VolunteerRegistrationInline(StackedPolymorphicInline.Child): + model = VolunteerRegistration + show_change_link = True + + model = Registration + child_inlines = ( + StudentRegistrationInline, + CoachRegistrationInline, + VolunteerRegistrationInline, + ) + + +class PaymentInline(admin.TabularInline): + model = Payment + extra = 0 + autocomplete_fields = ('registrations',) + + @admin.register(Registration) class RegistrationAdmin(PolymorphicParentModelAdmin): child_models = (StudentRegistration, CoachRegistration, VolunteerRegistration,) @@ -97,12 +129,34 @@ class VolunteerRegistrationAdmin(PolymorphicChildModelAdmin): @admin.register(Payment) class PaymentAdmin(ModelAdmin): - list_display = ('id', 'concerned_people', 'grouped', 'type', 'valid', ) - search_fields = ('registrations__user__last_name', 'registrations__user__first_name', 'registrations__user__email',) + list_display = ('concerned_people', 'tournament', 'team', 'grouped', 'type', 'amount', 'valid', ) + search_fields = ('registrations__user__last_name', 'registrations__user__first_name', 'registrations__user__email', + 'registrations__team__name', 'registrations__team__participation__team__trigram',) list_filter = ('registrations__team__participation__valid', 'type', - 'grouped', 'valid', 'registrations__polymorphic_ctype',) + 'grouped', 'valid', 'registrations__team__participation__tournament', 'final',) autocomplete_fields = ('registrations',) + actions = ('mark_as_valid', 'mark_as_pending', 'mark_as_invalid',) @admin.display(description=_('concerned people')) def concerned_people(self, record: Payment): return ", ".join(f"{reg.user.first_name} {reg.user.last_name}" for reg in record.registrations.all()) + + @admin.action(description=_('Mark as valid')) + def mark_as_valid(self, request, queryset): + queryset.update(valid=True) + + @admin.action(description=_('Mark as pending')) + def mark_as_pending(self, request, queryset): + queryset.update(valid=None) + + @admin.action(description=_('Mark as invalid')) + def mark_as_invalid(self, request, queryset): + queryset.update(valid=False) + + +admin.site.unregister(User) + + +@admin.register(User) +class UserCustomAdmin(PolymorphicInlineSupportMixin, UserAdmin): + inlines = [RegistrationInline] diff --git a/registration/models.py b/registration/models.py index 4ebdea4..2aaa19c 100644 --- a/registration/models.py +++ b/registration/models.py @@ -589,6 +589,8 @@ class Payment(models.Model): @property def team(self): return self.registrations.first().team + team.fget.short_description = _("team") + team.fget.admin_order_field = 'registrations__team__trigram' @property def tournament(self): @@ -596,6 +598,8 @@ class Payment(models.Model): from participation.models import Tournament return Tournament.final_tournament() return self.registrations.first().team.participation.tournament + tournament.fget.short_description = _("tournament") + tournament.fget.admin_order_field = 'registrations__team__participation__tournament' def get_checkout_intent(self, none_if_link_disabled=False): if self.checkout_intent_id is None: