It refactors the category filter of the gfdrr_det/api/v1/exposures endpoint in order to allow filtering by multiple values even if some of them are not valid. It replaces the usage of a MultipleChoiceFilter with a custom CategoryInFilter. This has two side-effects:
The filter now accepts a comma separated list of values instead of being specified multiple times
It accepts arbitrary strings for the filtering instead of allowing only categories which were valid
The implementation of the filtering was done using a custom method and django Q objects that are OR'ed together. This customization was necessary because the current version of django does not support using the in lookup field on JSONFields.
Filtering exposure layers by categories should now be done like this:
This PR is connected to #15
It refactors the
category
filter of thegfdrr_det/api/v1/exposures
endpoint in order to allow filtering by multiple values even if some of them are not valid. It replaces the usage of aMultipleChoiceFilter
with a customCategoryInFilter
. This has two side-effects:The implementation of the filtering was done using a custom method and django
Q
objects that are OR'ed together. This customization was necessary because the current version of django does not support using thein
lookup field onJSONField
s.Filtering exposure layers by categories should now be done like this: