We have added a number of CSV download views recently. These integrate with the django_rest_framework via SmartListMixin, which provides filtering. All of our download views should be refactored as follows:
extract the CSV generation code into an abstract parent class, e.g. CSVDownloadView. This would inherit from View.
extract the queryset fetching into a mixin with a get_queryset method.
each concrete download view inherits from the above mixin and the download view.
We have added a number of CSV download views recently. These integrate with the
django_rest_framework
viaSmartListMixin
, which provides filtering. All of our download views should be refactored as follows:CSVDownloadView
. This would inherit fromView
.get_queryset
method.