Tag: csv

Export object_list of a django-filters FilterView to CSV

This is a simple way to allow users to export the data they have just filtered using django-filterĀ as CSV. # Normal View (has a link to export view and keeps GET parameters) @method_decorator(staff_member_required(login_url=’user_login’), name=’dispatch’) class PaymentListView(FilterView): filterset_class = filters.PaymentFilter template_name = “barsys/userarea/payment_list.html” paginate_by = 10 # Export View @method_decorator(staff_member_required(login_url=’user_login’), name=’dispatch’) class PaymentExportView(FilterView): filterset_class = filters.PaymentFilter Read More