示例#1
0
 def elections_done(self, year=None):
     if year is None:
         elections = Election.objects.filter(admin_id__in=[
             profile.helios_user_id for profile in self.institutionuserprofile_set.all()],
             frozen_at__isnull=False,
             voting_ended_at__isnull=False).order_by("short_name")
     else:
         elections = Election.objects.filter(admin_id__in=[
             profile.helios_user_id for profile in self.institutionuserprofile_set.all()],
             created_at__year=year,
             frozen_at__isnull=False,
             voting_ended_at__isnull=False).order_by("short_name")
     return utils.elections_as_json(elections)
示例#2
0
 def elections_done(self, year=None):
     if year is None:
         elections = Election.objects.filter(admin_id__in=[
             profile.helios_user_id for profile in self.institutionuserprofile_set.all()],
             frozen_at__isnull=False,
             archived_at__isnull=True,
             voting_ended_at__isnull=False).order_by("short_name")
     else:
         elections = Election.objects.filter(admin_id__in=[
             profile.helios_user_id for profile in self.institutionuserprofile_set.all()],
             created_at__year=year,
             frozen_at__isnull=False,
             archived_at__isnull=True,
             voting_ended_at__isnull=False).order_by("short_name")
     return utils.elections_as_json(elections)
示例#3
0
 def elections(self):
     elections = Election.objects.filter(admin__in=[
         user for user in self.institutionuserprofile_set.all()]).order_by('-created_at')
         
     return utils.elections_as_json(elections)
示例#4
0
 def elections(self):
     elections = Election.objects.filter(admin__in=[
         user for user in self.institutionuserprofile_set.all()]).order_by('-created_at')
         
     return utils.elections_as_json(elections)