Commit a3a5a044 authored by Jean-Baptiste Lenglet's avatar Jean-Baptiste Lenglet Committed by Sli

Finished main view. Some tuning are to be done.

parent 9ac1cab9
......@@ -36,6 +36,9 @@ class Election(models.Model):
now = timezone.now()
return bool(now <= self.end_candidature and now >= self.start_candidature)
def has_voted(self, user):
return hasattr(user, 'has_voted') and user.has_voted.all() == list(self.role.all())
# Permissions
......
......@@ -40,7 +40,7 @@ class VoteCheckbox(forms.ModelMultipleChoiceField):
def validate(self, qs):
if qs.count() > self.max_choice:
raise forms.ValidationError(_("You have selected too much candidate"))
raise forms.ValidationError(_("You have selected too much candidates."), code='invalid')
# Forms
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment