From 31550a4ca7fecd1a522d9398e56f97a8407d4ade Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Tue, 6 Sep 2011 10:07:51 +0200 Subject: [PATCH] database way for the last commit --- openslides/assignment/models.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index b8fb105d2..899ca9af9 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -69,21 +69,7 @@ class Assignment(models.Model): @property def candidates(self): - # list of candidates - from poll.models import Option - candidates = [] - - def unique(candidates): - newcandidates = [] - for candidate in candidates: - if not candidate in newcandidates: - newcandidates.append(candidate) - return newcandidates - - - for option in Option.objects.filter(poll__assignment=self).order_by('user__user__first_name'): - candidates.append(option.value) - return unique(candidates) + return Profile.objects.filter(option__poll__assignment=self).order_by('user__first_name').distinct() def set_elected(self, profile, value=True): if profile in self.candidates: