Skip to content

Add filters for representatives

njoyard requested to merge filter-representatives-22d27829 into 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

Merge request reports

Loading