An mixin for views with a queryset that provides a CSV/Excel export.
Project description
django-spreadsheetresponsemixin
View mixin for django, that generates a csv or excel sheet.
Usage
Add to your django view as a mixin e.g.
- class ExcelExportView(SpreadsheetResponseMixin, ListView):
- def get(self, request):
self.queryset = self.get_queryset() return self.render_excel_response()
- class CsvExportView(SpreadsheetResponseMixin, ListView):
- def get(self, request):
self.queryset = self.get_queryset() return self.render_csv_response()
Note you must specify a Queryset, ValuesQueryset or ValuesListQueryset on the class or pass it in when you call the render method.
You can also specify the fields and the headers as tuples if you want to refine the results and / or provide custom headers for your columns
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-spreadsheetresponsemixin-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b674ac053228e18703db59b81d94e66e50b603753747d12b0b9c1c847dd4581 |
|
MD5 | 0d5124aa5d728a87c2b152f57614c64e |
|
BLAKE2b-256 | 6330491caadd9ef076113b14935b55eb25be0f315529e76261e8f6f6e94cb179 |