Skip to content

Add filters for representatives

njoyard a demandé de fusionner filter-representatives-22d27829 vers master

Created by: njoyard

This PR adds a filter form that uses django-filters on the representative list with the following criteria:

  • search: identical to the previously existing search box, searches representatives by name
  • chamber: static drop down list to filter by chamber
  • country: static drop down list to filter by country
  • group: autocompleted drop down to filter by all kinds of groups (except chamber and country) : party, committee, delegation, ...

The group URLs (like /legislature/representatives/committee/European Parliament/Committee on Defense whatever) are now 301-redirected to an URL with querystring parameters in order to pre-fill the filter form.

TODO:

  • fix select2 style to match the rest of the form
  • ensure the filter form always submits to the root representative list url instead of the current page url (not really needed but just in case)
  • add a checkbox to choose active/inactive meps postponed until we have an easy way to turn options/selects into a nice bootstrap button group
  • add something more obvious when there are no results
  • add a media block to the root template to allow page templates to add to it not needed, we have a head block already
  • change the way groups are displayed in the ac (add abbreviation, make group type more obvious) doesn't seem possible currently with select2
  • add filter tests
  • check duplicate meps issue again
  • fix missing querystring in page links

Preview:

preview

Rapports de requête de fusion