mirror of
https://github.com/ae-utbm/sith.git
synced 2026-01-19 17:30:08 +00:00
fix: bad value for blank vote and better flow for invalid form
* Add an error message when looking at a public election without being logged in * Add correct value for blank vote on single vote field * Redirect to view with an error message if an invalid form has been submitted
This commit is contained in:
@@ -60,8 +60,6 @@ class CandidateForm(forms.ModelForm):
|
||||
class VoteForm(forms.Form):
|
||||
def __init__(self, election: Election, user: User, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
if not election.can_vote(user):
|
||||
return
|
||||
for role in election.roles.all():
|
||||
cand = role.candidatures
|
||||
if role.max_choice > 1:
|
||||
@@ -74,6 +72,7 @@ class VoteForm(forms.Form):
|
||||
required=False,
|
||||
widget=forms.RadioSelect(),
|
||||
empty_label=_("Blank vote"),
|
||||
blank=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user