From 33d8c14da5115b2375079d5eaf2c5f40eff5d8ba Mon Sep 17 00:00:00 2001 From: klmp200 Date: Fri, 23 Dec 2016 00:34:30 +0100 Subject: [PATCH] can_vote in Election --- election/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/election/models.py b/election/models.py index 717d5598..9e3cdf15 100644 --- a/election/models.py +++ b/election/models.py @@ -48,6 +48,12 @@ class Election(models.Model): return True return False + def can_vote(self, user): + for group in self.vote_groups.all(): + if user.is_in_group(group): + return True + return False + # Permissions