From 75d8ec22652ad6ce8e17e2be4a197c759fcb489e Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 5 May 2020 22:29:10 +0200 Subject: [PATCH] Fix send solution error --- apps/tournament/views.py | 14 +++++++++++--- locale/fr/LC_MESSAGES/django.po | 8 ++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/tournament/views.py b/apps/tournament/views.py index 19a3afb..7cebc6e 100644 --- a/apps/tournament/views.py +++ b/apps/tournament/views.py @@ -224,6 +224,10 @@ class SolutionsView(TeamMixin, BaseFormView, SingleTableView): return super().post(request, *args, **kwargs) + def get_context_data(self, **kwargs): + self.object_list = self.get_queryset() + return super().get_context_data(**kwargs) + def get_queryset(self): qs = super().get_queryset() if not self.request.user.admin: @@ -236,7 +240,7 @@ class SolutionsView(TeamMixin, BaseFormView, SingleTableView): solution.final = solution.team.selected_for_final if timezone.now() > solution.tournament.date_solutions: - form.add_error('file', _("You can't publish your solution anymore. Deadline: {date:%m-%d-%Y %h:%M}.") + form.add_error('file', _("You can't publish your solution anymore. Deadline: {date:%m-%d-%Y %H:%M}.") .format(date=solution.tournament.date_solutions)) return super().form_invalid(form) @@ -334,6 +338,10 @@ class SynthesesView(TeamMixin, BaseFormView, SingleTableView): return qs.order_by('team__tournament__date_start', 'team__tournament__name', 'team__trigram', 'round', 'source',) + def get_context_data(self, **kwargs): + self.object_list = self.get_queryset() + return super().get_context_data(**kwargs) + def form_valid(self, form): synthesis = form.instance synthesis.team = self.request.user.team @@ -341,13 +349,13 @@ class SynthesesView(TeamMixin, BaseFormView, SingleTableView): if synthesis.round == '1' and timezone.now() > synthesis.tournament.date_syntheses: form.add_error('file', _("You can't publish your synthesis anymore for the first round." - " Deadline: {date:%m-%d-%Y %h:%M}.") + " Deadline: {date:%m-%d-%Y %H:%M}.") .format(date=synthesis.tournament.date_syntheses)) return super().form_invalid(form) if synthesis.round == '2' and timezone.now() > synthesis.tournament.date_syntheses_2: form.add_error('file', _("You can't publish your synthesis anymore for the second round." - " Deadline: {date:%m-%d-%Y %h:%M}.") + " Deadline: {date:%m-%d-%Y %H:%M}.") .format(date=synthesis.tournament.date_syntheses_2)) return super().form_invalid(form) diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 2cb857f..5b2601a 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -610,9 +610,9 @@ msgstr "Solutions" #: apps/tournament/views.py:239 msgid "" -"You can't publish your solution anymore. Deadline: {date:%m-%d-%Y %h:%M}." +"You can't publish your solution anymore. Deadline: {date:%m-%d-%Y %H:%M}." msgstr "" -"Vous ne pouvez plus publier vos solutions. Deadline : {date:%d/%m/%Y %h:%M}." +"Vous ne pouvez plus publier vos solutions. Deadline : {date:%d/%m/%Y %H:%M}." #: apps/tournament/views.py:263 msgid "All solutions" @@ -636,7 +636,7 @@ msgstr "Notes de synthèse de l'équipe {team}.zip" #: apps/tournament/views.py:343 msgid "" "You can't publish your synthesis anymore for the first round. Deadline: " -"{date:%m-%d-%Y %h:%M}." +"{date:%m-%d-%Y %H:%M}." msgstr "" "Vous ne pouvez plus envoyer vos notes de synthèse pour le premier tour. " "Deadline : {date:%d/%m/%Y %h:%M}." @@ -644,7 +644,7 @@ msgstr "" #: apps/tournament/views.py:349 msgid "" "You can't publish your synthesis anymore for the second round. Deadline: " -"{date:%m-%d-%Y %h:%M}." +"{date:%m-%d-%Y %H:%M}." msgstr "" "Vous ne pouvez plus envoyer vos notes de synthèse pour le second tour. " "Deadline : {date:%d/%m/%Y %h:%M}."