Finished main view. Some tuning are to be done.

This commit is contained in:
Jean-Baptiste Lenglet
2016-12-22 21:16:46 +01:00
committed by klmp200
parent 9ac1cab983
commit a3a5a0446d
3 changed files with 117 additions and 78 deletions

View File

@ -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