From 7faeac7dacb8b00a4e84ece041c713895d10c654 Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@adida.net> Date: Sun, 27 May 2012 21:50:37 -0700 Subject: [PATCH] more fixes for category --- helios/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/helios/models.py b/helios/models.py index c3a5637..7e0511c 100644 --- a/helios/models.py +++ b/helios/models.py @@ -263,8 +263,12 @@ class Election(HeliosModel): if not self.eligibility: return None - constraint = self.eligibility_constraint_for(user_type)[0] - return AUTH_SYSTEMS[user_type].eligibility_category_id(constraint) + constraint_for = self.eligibility_constraint_for(user_type) + if len(constraint_for) > 0: + constraint = constraint_for[0] + return AUTH_SYSTEMS[user_type].eligibility_category_id(constraint) + else: + return None @property def pretty_eligibility(self): -- GitLab