diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content index e43743c271267cb3e3fc4f068e9401a5e4cf2f57..48d792e8633824b2ac5852847565d003f16c8508 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=&search=&group=&chamber=1&page=4'> - 4 - - </a> - </li> - - - <li> <a aria-label='Next' href='?country=&search=&group=&chamber=1&page=2'> @@ -214,7 +203,7 @@ </a> </li> <li> - <a aria-label='Last' href='?country=&search=&group=&chamber=1&page=21'> + <a aria-label='Last' href='?country=&search=&group=&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'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'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'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'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'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=&search=&group=&chamber=1&page=4'> - 4 - - </a> - </li> - - - <li> <a aria-label='Next' href='?country=&search=&group=&chamber=1&page=2'> @@ -758,7 +736,7 @@ </a> </li> <li> - <a aria-label='Last' href='?country=&search=&group=&chamber=1&page=21'> + <a aria-label='Last' href='?country=&search=&group=&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 c7ad17e354f928d460d3c892218bae093627de83..17175fa144ab88fd5f33c1fd6e83036a2d4e7f7c 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 b5efe7232c3d65eee5a1482c0b8d16ebb0d72065..a174ef6789b29e7ec6719273152734740e5b13b4 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()