Skip to content
Extraits de code Groupes Projets
Valider 83bfc3ef rédigé par James Pic's avatar James Pic
Parcourir les fichiers

Merge pull request #54 from political-memory/display_votes_with_recommendations_only

Display votes with recommendation only
parents 8021d5f7 9e751c93
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -5,7 +5,7 @@ from core.views import GridListMixin, PaginationMixin, CSVDownloadMixin ...@@ -5,7 +5,7 @@ from core.views import GridListMixin, PaginationMixin, CSVDownloadMixin
from representatives import views as representatives_views from representatives import views as representatives_views
from representatives.models import Representative from representatives.models import Representative
from representatives_votes import views as representatives_votes_views from representatives_votes import views as representatives_votes_views
from representatives_votes.models import Dossier from representatives_votes.models import Dossier, Proposal
from representatives_positions.forms import PositionForm from representatives_positions.forms import PositionForm
from representatives_recommendations.models import ScoredVote from representatives_recommendations.models import ScoredVote
...@@ -42,7 +42,9 @@ class RepresentativeDetail(representatives_views.RepresentativeDetail): ...@@ -42,7 +42,9 @@ class RepresentativeDetail(representatives_views.RepresentativeDetail):
def get_queryset(self): def get_queryset(self):
qs = super(RepresentativeDetail, self).get_queryset() qs = super(RepresentativeDetail, self).get_queryset()
votes = ScoredVote.objects.select_related('proposal__recommendation') votes = ScoredVote.objects.filter(
proposal__in=Proposal.objects.exclude(recommendation=None),
).select_related('proposal__recommendation')
qs = qs.prefetch_related(models.Prefetch('votes', queryset=votes)) qs = qs.prefetch_related(models.Prefetch('votes', queryset=votes))
return qs return qs
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter