From 62fc5e088b8eb31ffae87cf0374630ad2ebe2283 Mon Sep 17 00:00:00 2001
From: Nicolas Joyard <joyard.nicolas@gmail.com>
Date: Sat, 18 Jun 2016 08:31:04 +0200
Subject: [PATCH] Ensure no dupes in rep list, fixes #93

---
 ...tativeListTest.test_filter_chamber.content | 204 ++++++++----------
 ...ativeListTest.test_filter_multiple.content | 174 +--------------
 memopol/views/representative_list.py          |   2 +-
 3 files changed, 94 insertions(+), 286 deletions(-)

diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content
index e43743c2..48d792e8 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content
@@ -195,17 +195,6 @@
           
         
       
-        
-          
-            <li>
-              <a href='?country=&amp;search=&amp;group=&amp;chamber=1&page=4'>
-                4
-
-              </a>
-            </li>
-          
-        
-      
       
         <li>
           <a aria-label='Next' href='?country=&amp;search=&amp;group=&amp;chamber=1&page=2'>
@@ -214,7 +203,7 @@
           </a>
         </li>
         <li>
-          <a aria-label='Last' href='?country=&amp;search=&amp;group=&amp;chamber=1&page=21'>
+          <a aria-label='Last' href='?country=&amp;search=&amp;group=&amp;chamber=1&page=3'>
             <i aria-hidden="true" class="fa fa-chevron-circle-right"></i>
 
           </a>
@@ -223,7 +212,7 @@
     </ul>
   </nav>
   <div class='count'>
-    Number of results : 252
+    Number of results : 36
 
     
       <br />
@@ -326,14 +315,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/zigmantas-balcytis/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96680.jpg' width='80' />
+          <a href='/legislature/representative/vilija-blinkeviciute/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/96681.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/zigmantas-balcytis/'>
-              Zigmantas BALÄŒYTIS
+            <a href='/legislature/representative/vilija-blinkeviciute/'>
+              Vilija BLINKEVIČIŪTĖ
             </a>
           </li>
           <li class='chamber'>
@@ -360,14 +349,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/zigmantas-balcytis/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96680.jpg' width='80' />
+          <a href='/legislature/representative/elmar-brok/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/1263.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/zigmantas-balcytis/'>
-              Zigmantas BALÄŒYTIS
+            <a href='/legislature/representative/elmar-brok/'>
+              Elmar BROK
             </a>
           </li>
           <li class='chamber'>
@@ -376,17 +365,17 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/Germany/'>
+              <span class="flag-icon flag-icon-de"></span> Germany
             </a>
           </li>
           <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>
-              <span class="group-icon group-icon-sd"></span> SD
+            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20European%20People&#39;s%20Party%20(Christian%20Democrats)/'>
+              <span class="group-icon group-icon-epp"></span> EPP
             </a>
           </li>
           <li class='score'>
-            <span class="label label-success">15</span>
+            <span class="label label-danger">-10</span>
 
           </li>
         </ul>
@@ -394,14 +383,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/zigmantas-balcytis/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96680.jpg' width='80' />
+          <a href='/legislature/representative/cristian-silviu-busoi/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/38420.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/zigmantas-balcytis/'>
-              Zigmantas BALÄŒYTIS
+            <a href='/legislature/representative/cristian-silviu-busoi/'>
+              Cristian-Silviu BUÅžOI
             </a>
           </li>
           <li class='chamber'>
@@ -410,13 +399,13 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/Romania/'>
+              <span class="flag-icon flag-icon-ro"></span> Romania
             </a>
           </li>
           <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>
-              <span class="group-icon group-icon-sd"></span> SD
+            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20European%20People&#39;s%20Party%20(Christian%20Democrats)/'>
+              <span class="group-icon group-icon-epp"></span> EPP
             </a>
           </li>
           <li class='score'>
@@ -428,14 +417,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/zigmantas-balcytis/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96680.jpg' width='80' />
+          <a href='/legislature/representative/david-casa/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/28122.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/zigmantas-balcytis/'>
-              Zigmantas BALÄŒYTIS
+            <a href='/legislature/representative/david-casa/'>
+              David CASA
             </a>
           </li>
           <li class='chamber'>
@@ -444,17 +433,17 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/Malta/'>
+              <span class="flag-icon flag-icon-mt"></span> Malta
             </a>
           </li>
           <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>
-              <span class="group-icon group-icon-sd"></span> SD
+            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20European%20People&#39;s%20Party%20(Christian%20Democrats)/'>
+              <span class="group-icon group-icon-epp"></span> EPP
             </a>
           </li>
           <li class='score'>
-            <span class="label label-success">15</span>
+            <span class="label label-danger">-15</span>
 
           </li>
         </ul>
@@ -462,14 +451,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/zigmantas-balcytis/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96680.jpg' width='80' />
+          <a href='/legislature/representative/jean-marie-cavada/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/28206.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/zigmantas-balcytis/'>
-              Zigmantas BALÄŒYTIS
+            <a href='/legislature/representative/jean-marie-cavada/'>
+              Jean-Marie CAVADA
             </a>
           </li>
           <li class='chamber'>
@@ -478,17 +467,17 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/France/'>
+              <span class="flag-icon flag-icon-fr"></span> France
             </a>
           </li>
           <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>
-              <span class="group-icon group-icon-sd"></span> SD
+            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Alliance%20of%20Liberals%20and%20Democrats%20for%20Europe/'>
+              <span class="group-icon group-icon-alde"></span> ALDE
             </a>
           </li>
           <li class='score'>
-            <span class="label label-success">15</span>
+            <span class="label label-danger">-15</span>
 
           </li>
         </ul>
@@ -496,14 +485,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/zigmantas-balcytis/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96680.jpg' width='80' />
+          <a href='/legislature/representative/nikolaos-chountis/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/26851.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/zigmantas-balcytis/'>
-              Zigmantas BALÄŒYTIS
+            <a href='/legislature/representative/nikolaos-chountis/'>
+              Nikolaos CHOUNTIS
             </a>
           </li>
           <li class='chamber'>
@@ -512,13 +501,13 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/Greece/'>
+              <span class="flag-icon flag-icon-gr"></span> Greece
             </a>
           </li>
           <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>
-              <span class="group-icon group-icon-sd"></span> SD
+            <a href='/legislature/representative/group/European%20Parliament/Confederal%20Group%20of%20the%20European%20United%20Left%20-%20Nordic%20Green%20Left/'>
+              <span class="group-icon group-icon-guengl"></span> GUE/NGL
             </a>
           </li>
           <li class='score'>
@@ -530,14 +519,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/vilija-blinkeviciute/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96681.jpg' width='80' />
+          <a href='/legislature/representative/michael-cramer/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/28238.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/vilija-blinkeviciute/'>
-              Vilija BLINKEVIČIŪTĖ
+            <a href='/legislature/representative/michael-cramer/'>
+              Michael CRAMER
             </a>
           </li>
           <li class='chamber'>
@@ -546,13 +535,13 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/Germany/'>
+              <span class="flag-icon flag-icon-de"></span> Germany
             </a>
           </li>
           <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>
-              <span class="group-icon group-icon-sd"></span> SD
+            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Greens/European%20Free%20Alliance/'>
+              <span class="group-icon group-icon-greensefa"></span> Greens/EFA
             </a>
           </li>
           <li class='score'>
@@ -564,14 +553,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/vilija-blinkeviciute/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96681.jpg' width='80' />
+          <a href='/legislature/representative/michel-dantin/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/97296.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/vilija-blinkeviciute/'>
-              Vilija BLINKEVIČIŪTĖ
+            <a href='/legislature/representative/michel-dantin/'>
+              Michel DANTIN
             </a>
           </li>
           <li class='chamber'>
@@ -580,17 +569,17 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/France/'>
+              <span class="flag-icon flag-icon-fr"></span> France
             </a>
           </li>
           <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>
-              <span class="group-icon group-icon-sd"></span> SD
+            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20European%20People&#39;s%20Party%20(Christian%20Democrats)/'>
+              <span class="group-icon group-icon-epp"></span> EPP
             </a>
           </li>
           <li class='score'>
-            <span class="label label-success">15</span>
+            <span class="label label-danger">-15</span>
 
           </li>
         </ul>
@@ -598,14 +587,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/vilija-blinkeviciute/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96681.jpg' width='80' />
+          <a href='/legislature/representative/tamas-deutsch/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/96826.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/vilija-blinkeviciute/'>
-              Vilija BLINKEVIČIŪTĖ
+            <a href='/legislature/representative/tamas-deutsch/'>
+              Tamás DEUTSCH
             </a>
           </li>
           <li class='chamber'>
@@ -614,17 +603,17 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/Hungary/'>
+              <span class="flag-icon flag-icon-hu"></span> Hungary
             </a>
           </li>
           <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>
-              <span class="group-icon group-icon-sd"></span> SD
+            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20European%20People&#39;s%20Party%20(Christian%20Democrats)/'>
+              <span class="group-icon group-icon-epp"></span> EPP
             </a>
           </li>
           <li class='score'>
-            <span class="label label-success">15</span>
+            <span class="label label-danger">-15</span>
 
           </li>
         </ul>
@@ -632,14 +621,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/vilija-blinkeviciute/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96681.jpg' width='80' />
+          <a href='/legislature/representative/viorica-dancila/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/95281.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/vilija-blinkeviciute/'>
-              Vilija BLINKEVIČIŪTĖ
+            <a href='/legislature/representative/viorica-dancila/'>
+              Viorica DÄ‚NCILÄ‚
             </a>
           </li>
           <li class='chamber'>
@@ -648,8 +637,8 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/Romania/'>
+              <span class="flag-icon flag-icon-ro"></span> Romania
             </a>
           </li>
           <li class='mandate'>
@@ -666,14 +655,14 @@
     
       <div class='representative_item active'>
         <p class='photo'>
-          <a href='/legislature/representative/vilija-blinkeviciute/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/96681.jpg' width='80' />
+          <a href='/legislature/representative/bas-eickhout/'>
+            <img src='http://www.europarl.europa.eu/mepphoto/96725.jpg' width='80' />
           </a>
         </p>
         <ul>
           <li class='name'>
-            <a href='/legislature/representative/vilija-blinkeviciute/'>
-              Vilija BLINKEVIČIŪTĖ
+            <a href='/legislature/representative/bas-eickhout/'>
+              Bas EICKHOUT
             </a>
           </li>
           <li class='chamber'>
@@ -682,13 +671,13 @@
             </a>
           </li>
           <li class='country'>
-            <a href='/legislature/representative/country/Lithuania/'>
-              <span class="flag-icon flag-icon-lt"></span> Lithuania
+            <a href='/legislature/representative/country/Netherlands/'>
+              <span class="flag-icon flag-icon-nl"></span> Netherlands
             </a>
           </li>
           <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>
-              <span class="group-icon group-icon-sd"></span> SD
+            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Greens/European%20Free%20Alliance/'>
+              <span class="group-icon group-icon-greensefa"></span> Greens/EFA
             </a>
           </li>
           <li class='score'>
@@ -739,17 +728,6 @@
           
         
       
-        
-          
-            <li>
-              <a href='?country=&amp;search=&amp;group=&amp;chamber=1&page=4'>
-                4
-
-              </a>
-            </li>
-          
-        
-      
       
         <li>
           <a aria-label='Next' href='?country=&amp;search=&amp;group=&amp;chamber=1&page=2'>
@@ -758,7 +736,7 @@
           </a>
         </li>
         <li>
-          <a aria-label='Last' href='?country=&amp;search=&amp;group=&amp;chamber=1&page=21'>
+          <a aria-label='Last' href='?country=&amp;search=&amp;group=&amp;chamber=1&page=3'>
             <i aria-hidden="true" class="fa fa-chevron-circle-right"></i>
 
           </a>
@@ -767,7 +745,7 @@
     </ul>
   </nav>
   <div class='count'>
-    Number of results : 252
+    Number of results : 36
 
     
       <br />
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_multiple.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_multiple.content
index c7ad17e3..17175fa1 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_multiple.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_multiple.content
@@ -168,7 +168,7 @@
     </ul>
   </nav>
   <div class='count'>
-    Number of results : 6
+    Number of results : 1
 
     
       <br />
@@ -269,176 +269,6 @@
         </ul>
       </div>
     
-      <div class='representative_item active'>
-        <p class='photo'>
-          <a href='/legislature/representative/jean-marie-cavada/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/28206.jpg' width='80' />
-          </a>
-        </p>
-        <ul>
-          <li class='name'>
-            <a href='/legislature/representative/jean-marie-cavada/'>
-              Jean-Marie CAVADA
-            </a>
-          </li>
-          <li class='chamber'>
-            <a href='/legislature/representative/chamber/European%20Parliament/'>
-              <span class="chamber-icon chamber-icon-ep"></span> European Parliament
-            </a>
-          </li>
-          <li class='country'>
-            <a href='/legislature/representative/country/France/'>
-              <span class="flag-icon flag-icon-fr"></span> France
-            </a>
-          </li>
-          <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Alliance%20of%20Liberals%20and%20Democrats%20for%20Europe/'>
-              <span class="group-icon group-icon-alde"></span> ALDE
-            </a>
-          </li>
-          <li class='score'>
-            <span class="label label-danger">-15</span>
-
-          </li>
-        </ul>
-      </div>
-    
-      <div class='representative_item active'>
-        <p class='photo'>
-          <a href='/legislature/representative/jean-marie-cavada/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/28206.jpg' width='80' />
-          </a>
-        </p>
-        <ul>
-          <li class='name'>
-            <a href='/legislature/representative/jean-marie-cavada/'>
-              Jean-Marie CAVADA
-            </a>
-          </li>
-          <li class='chamber'>
-            <a href='/legislature/representative/chamber/European%20Parliament/'>
-              <span class="chamber-icon chamber-icon-ep"></span> European Parliament
-            </a>
-          </li>
-          <li class='country'>
-            <a href='/legislature/representative/country/France/'>
-              <span class="flag-icon flag-icon-fr"></span> France
-            </a>
-          </li>
-          <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Alliance%20of%20Liberals%20and%20Democrats%20for%20Europe/'>
-              <span class="group-icon group-icon-alde"></span> ALDE
-            </a>
-          </li>
-          <li class='score'>
-            <span class="label label-danger">-15</span>
-
-          </li>
-        </ul>
-      </div>
-    
-      <div class='representative_item active'>
-        <p class='photo'>
-          <a href='/legislature/representative/jean-marie-cavada/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/28206.jpg' width='80' />
-          </a>
-        </p>
-        <ul>
-          <li class='name'>
-            <a href='/legislature/representative/jean-marie-cavada/'>
-              Jean-Marie CAVADA
-            </a>
-          </li>
-          <li class='chamber'>
-            <a href='/legislature/representative/chamber/European%20Parliament/'>
-              <span class="chamber-icon chamber-icon-ep"></span> European Parliament
-            </a>
-          </li>
-          <li class='country'>
-            <a href='/legislature/representative/country/France/'>
-              <span class="flag-icon flag-icon-fr"></span> France
-            </a>
-          </li>
-          <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Alliance%20of%20Liberals%20and%20Democrats%20for%20Europe/'>
-              <span class="group-icon group-icon-alde"></span> ALDE
-            </a>
-          </li>
-          <li class='score'>
-            <span class="label label-danger">-15</span>
-
-          </li>
-        </ul>
-      </div>
-    
-      <div class='representative_item active'>
-        <p class='photo'>
-          <a href='/legislature/representative/jean-marie-cavada/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/28206.jpg' width='80' />
-          </a>
-        </p>
-        <ul>
-          <li class='name'>
-            <a href='/legislature/representative/jean-marie-cavada/'>
-              Jean-Marie CAVADA
-            </a>
-          </li>
-          <li class='chamber'>
-            <a href='/legislature/representative/chamber/European%20Parliament/'>
-              <span class="chamber-icon chamber-icon-ep"></span> European Parliament
-            </a>
-          </li>
-          <li class='country'>
-            <a href='/legislature/representative/country/France/'>
-              <span class="flag-icon flag-icon-fr"></span> France
-            </a>
-          </li>
-          <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Alliance%20of%20Liberals%20and%20Democrats%20for%20Europe/'>
-              <span class="group-icon group-icon-alde"></span> ALDE
-            </a>
-          </li>
-          <li class='score'>
-            <span class="label label-danger">-15</span>
-
-          </li>
-        </ul>
-      </div>
-    
-      <div class='representative_item active'>
-        <p class='photo'>
-          <a href='/legislature/representative/jean-marie-cavada/'>
-            <img src='http://www.europarl.europa.eu/mepphoto/28206.jpg' width='80' />
-          </a>
-        </p>
-        <ul>
-          <li class='name'>
-            <a href='/legislature/representative/jean-marie-cavada/'>
-              Jean-Marie CAVADA
-            </a>
-          </li>
-          <li class='chamber'>
-            <a href='/legislature/representative/chamber/European%20Parliament/'>
-              <span class="chamber-icon chamber-icon-ep"></span> European Parliament
-            </a>
-          </li>
-          <li class='country'>
-            <a href='/legislature/representative/country/France/'>
-              <span class="flag-icon flag-icon-fr"></span> France
-            </a>
-          </li>
-          <li class='mandate'>
-            <a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Alliance%20of%20Liberals%20and%20Democrats%20for%20Europe/'>
-              <span class="group-icon group-icon-alde"></span> ALDE
-            </a>
-          </li>
-          <li class='score'>
-            <span class="label label-danger">-15</span>
-
-          </li>
-        </ul>
-      </div>
-    
   </div>
 
 
@@ -452,7 +282,7 @@
     </ul>
   </nav>
   <div class='count'>
-    Number of results : 6
+    Number of results : 1
 
     
       <br />
diff --git a/memopol/views/representative_list.py b/memopol/views/representative_list.py
index b5efe723..a174ef67 100644
--- a/memopol/views/representative_list.py
+++ b/memopol/views/representative_list.py
@@ -41,7 +41,7 @@ class RepresentativeList(CSVDownloadMixin, GridListMixin, PaginationMixin,
             qs = qs.filter(active=True)
         qs = self.rep_filter(qs)
         qs = self.prefetch_for_representative_country_and_main_mandate(qs)
-        return qs
+        return qs.distinct()
 
     def get_csv_results(self, context, **kwargs):
         qs = self.get_queryset()
-- 
GitLab