refactor collection filters with django_filters
This MR aims to re-implement existing collection filters in api viewsets that are implemented in get_queryset
methods with django-filter filtersets.
This has multiple advantages:
- DRF will auto-generate a filter form for the filterset fields when browsing the API with the browser, making it easier to browse & filter collections.
- Filter values can easily be validated and most are validated out-of-the-box.
- Filter documentation can be added per filter.
- django_filter is supported by drf-spectecular, which will generate a nice and tidy OpenAPI documentation for us.
Edited by Konrad Mohrfeldt
Merge request reports
Activity
added 1 commit
- 5bc18526 - refactor: use django_filters FilterSet for APITimeSlotViewSet
added 1 commit
- e7265de0 - refactor: use django_filters FilterSet for APITimeSlotViewSet
added 11 commits
- 0fed711d - refactor: use django_filters FilterSet for APIShowViewSet
- 6c8236d2 - refactor: use django_filters FilterSet for APITimeSlotViewSet
- 60a791ae - fix: don’t advertise prohibited API methods
- cf82526d - refactor: tidy up APIUserViewSet
- 2d9fd804 - refactor: implement active filter for various viewsets
- 24f6f06d - fix: fix audio_url generation for notes
- 3bfec8a5 - feat: add string representations for models
- 0dc2903b - fix: fix typo causing note creations to fail
- b3247ab5 - refactor: pre-fill show and timeslot data on note creation
- 29837872 - refactor: tidy up APIScheduleViewSet
- 7eaa0a49 - refactor: use django_filters FilterSet for APINoteViewSet
Toggle commit listThis is now ready to merge as far as I’m concerned. I’ve smuggled in some little features mainly for a better developer experience (like
__str__
methods on most models) and some fixes for things that seemed to be obviously broken. Apart from that the MR just contains the mentioned refactorings necessary for the use of django_filters.mentioned in commit 47d90bcc
Please register or sign in to reply