Hide inputs when user already voted.

This commit is contained in:
Jean-Baptiste Lenglet
2016-12-22 22:17:22 +01:00
committed by klmp200
parent dfcddbd1fa
commit 89362bae79
2 changed files with 24 additions and 15 deletions

View File

@ -37,7 +37,7 @@ class Election(models.Model):
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())
return hasattr(user, 'has_voted') and list(user.has_voted.all()) == list(self.role.all())
def can_candidate(self, user):
for group in self.candidature_groups.all():