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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b49071234295e7a4d628c492c2d217da880bd78b66b0173a075bde82265fd7ab |
|
MD5 | 9b2b0185af5038250d3f0c7587e86cf5 |
|
BLAKE2b-256 | b1cdac2fb478f2f8953348b506493ec48b792b2333506f902bfb3b9e3968eb49 |