Esempio n. 1
0
 def get_context_data(self, *args, **kwargs):
     context = super(VoteRecommendationChoice, self).get_context_data(**kwargs)
     context['choice'] = self.kwargs['recommendation']
     context['header_template'] = 'votes/header_mep_list.html'
     context['object_list'] = optimise_mep_query(MEP.objects.filter(vote__recommendation=self.object,
                                                                    vote__choice=self.kwargs['recommendation']),
                                                 Q(mep__vote__recommendation=self.object, mep__vote__choice=self.kwargs['recommendation']),
                                                 Q(representative__vote__recommendation=self.object, representative__vote__choice=self.kwargs['recommendation']))
     self.redirect_args += [self.kwargs['recommendation']]
     return context
Esempio n. 2
0
 def meps_with_votes(self):
     for mep in optimise_mep_query(MEP.objects.filter(vote__recommendation=self.object), Q(mep__score__proposal=self.object.proposal), Q(representative__score__proposal=self.object.proposal), choice_on_recommendation=self.object):
         yield mep, mep.choice  # bad bad bad, filter should disapear soon for a get
Esempio n. 3
0
 def get_context_data(self, *args, **kwargs):
     context = super(ProposalView, self).get_context_data(**kwargs)
     context["vote"].meps = optimise_mep_query(context["vote"].meps, Q(mep__score__proposal=context["vote"]), Q(representative__score__proposal=context["vote"]), proposal_score=context["vote"])
     return context