django-spreadsheetresponsemixin
View mixin for django, that generates a csv or excel sheet.
[](https://travis-ci.org/aptivate/django-spreadsheetresponsemixin)
Installation
pip install django-spreadsheetresponsemixin
Usage
Add to your django view as a mixin:
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.
Exported file will be named export.csv or export.xlsx by default, but you can change this by either specifying export_filename attribute to name exported file or export_filename_root to specify only the root part of it (and let app take care of the appropriate extension).
Changelog
Not available for 0.1.10 and earlier - sorry :s
Metadata
Release files for django-spreadsheetresponsemixin 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-spreadsheetresponsemixin-0.1.10.tar.gz | 39.7 kB | Without provenance | Details |
Release files / django-spreadsheetresponsemixin-0.1.10.tar.gz
| Download URL | django-spreadsheetresponsemixin-0.1.10.tar.gz |
|---|---|
| Size | 39.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49bc18d53ccc9e6301804f7b73ca54b1d1c3f9ced18540531647e17e9b1c4f54
|
|
BLAKE2b-256 checksum How to use checksums |
417aa99cee9e130b2868dcc1ffe8971f6ef1b31d8a4f3c6391cc8f54cf31ba19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-spreadsheetresponsemixin 0.1.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.