From 2c7678400702ff776a43210f7492b1f66be772ea Mon Sep 17 00:00:00 2001 From: klmp200 Date: Thu, 22 Dec 2016 23:17:35 +0100 Subject: [PATCH] Fixed Election.has_voted --- election/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/election/models.py b/election/models.py index 79e593b1..717d5598 100644 --- a/election/models.py +++ b/election/models.py @@ -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():