mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Fixed Election.has_voted
This commit is contained in:
parent
89362bae79
commit
2c76784007
@ -37,7 +37,10 @@ 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 list(user.has_voted.all()) == list(self.role.all())
|
||||
for role in self.role.all():
|
||||
if role.user_has_voted(user):
|
||||
return True
|
||||
return False
|
||||
|
||||
def can_candidate(self, user):
|
||||
for group in self.candidature_groups.all():
|
||||
|
Loading…
Reference in New Issue
Block a user