mirror of
https://github.com/ae-utbm/sith.git
synced 2025-09-16 13:03:51 +00:00
apply review comments
This commit is contained in:
@@ -27,7 +27,7 @@ class LimitedCheckboxField(forms.ModelMultipleChoiceField):
|
|||||||
def validate(self, qs):
|
def validate(self, qs):
|
||||||
if qs.count() > self.max_choice:
|
if qs.count() > self.max_choice:
|
||||||
raise forms.ValidationError(
|
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,
|
"election_list": AutoCompleteSelect,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, *args, election: Election, can_edit: bool = False, **kwargs):
|
||||||
self, *args, election: Election | None, can_edit: bool = False, **kwargs
|
|
||||||
):
|
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fields["role"].queryset = election.roles.select_related("election")
|
self.fields["role"].queryset = election.roles.select_related("election")
|
||||||
self.fields["election_list"].queryset = election.election_lists.all()
|
self.fields["election_list"].queryset = election.election_lists.all()
|
||||||
@@ -62,7 +60,7 @@ class CandidateForm(forms.ModelForm):
|
|||||||
class VoteForm(forms.Form):
|
class VoteForm(forms.Form):
|
||||||
def __init__(self, election: Election, user: User, *args, **kwargs):
|
def __init__(self, election: Election, user: User, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
if election.can_vote(user):
|
if not election.can_vote(user):
|
||||||
return
|
return
|
||||||
for role in election.roles.all():
|
for role in election.roles.all():
|
||||||
cand = role.candidatures
|
cand = role.candidatures
|
||||||
|
@@ -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"
|
msgstr "Vous ne pouvez pas acheter un rechargement avec de l'argent du sith"
|
||||||
|
|
||||||
#: election/forms.py
|
#: 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."
|
msgstr "Vous avez sélectionné trop de candidats."
|
||||||
|
|
||||||
#: election/forms.py
|
#: election/forms.py
|
||||||
|
Reference in New Issue
Block a user