From 9e751c93aa287d8407140f918db63ff485f7926e Mon Sep 17 00:00:00 2001
From: jpic <jamespic@gmail.com>
Date: Tue, 9 Feb 2016 20:03:39 +0100
Subject: [PATCH] Exclude votes without recommendation from display

---
 memopol/views.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/memopol/views.py b/memopol/views.py
index e668d1d4..e0f26602 100644
--- a/memopol/views.py
+++ b/memopol/views.py
@@ -5,7 +5,7 @@ from core.views import GridListMixin, PaginationMixin, CSVDownloadMixin
 from representatives import views as representatives_views
 from representatives.models import Representative
 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_recommendations.models import ScoredVote
 
@@ -42,7 +42,9 @@ class RepresentativeDetail(representatives_views.RepresentativeDetail):
 
     def get_queryset(self):
         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))
         return qs
 
-- 
GitLab