From b5863a73daef603fefa0510537beffdee949a978 Mon Sep 17 00:00:00 2001 From: imperosol Date: Fri, 27 Jun 2025 13:28:44 +0200 Subject: [PATCH] apply review comments --- election/forms.py | 8 +++----- locale/fr/LC_MESSAGES/django.po | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/election/forms.py b/election/forms.py index 8a4f7601..4532b85c 100644 --- a/election/forms.py +++ b/election/forms.py @@ -27,7 +27,7 @@ class LimitedCheckboxField(forms.ModelMultipleChoiceField): def validate(self, qs): if qs.count() > self.max_choice: raise forms.ValidationError( - _("You have selected too much candidates."), code="invalid" + _("You have selected too many candidates."), code="invalid" ) @@ -49,9 +49,7 @@ class CandidateForm(forms.ModelForm): "election_list": AutoCompleteSelect, } - def __init__( - self, *args, election: Election | None, can_edit: bool = False, **kwargs - ): + def __init__(self, *args, election: Election, can_edit: bool = False, **kwargs): super().__init__(*args, **kwargs) self.fields["role"].queryset = election.roles.select_related("election") self.fields["election_list"].queryset = election.election_lists.all() @@ -62,7 +60,7 @@ class CandidateForm(forms.ModelForm): class VoteForm(forms.Form): def __init__(self, election: Election, user: User, *args, **kwargs): super().__init__(*args, **kwargs) - if election.can_vote(user): + if not election.can_vote(user): return for role in election.roles.all(): cand = role.candidatures diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 10942953..e65c2b6d 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -3898,7 +3898,7 @@ msgid "You can't buy a refilling with sith money" msgstr "Vous ne pouvez pas acheter un rechargement avec de l'argent du sith" #: election/forms.py -msgid "You have selected too much candidates." +msgid "You have selected too many candidates." msgstr "Vous avez sélectionné trop de candidats." #: election/forms.py