django-excel-response
A subclass of HttpResponse which will transform a QuerySet, or sequence of sequences, into either an Excel spreadsheet or CSV file formatted for Excel, depending on the amount of data.
Installation
pip install django-excel-response
Provided Classes
excel_response.response.ExcelResponse
Accepted arguments:
data - A queryset or list of lists from which to construct the output
output_filename - The filename which should be suggested in the http response, minus the file extension (default: excel_data)
worksheet_name - The name of the worksheet inside the spreadsheet into which the data will be inserted (default: None)
force_csv - A boolean stating whether to force CSV output (default: False)
header_font - The font to be applied to the header row of the spreadsheet; must be an instance of openpyxl.styles.Font (default: None)
data_font - The font to be applied to all data cells in the spreadsheet; must be an instance of openpyxl.styles.Font (default: None)
excel_response.views.ExcelMixin
excel_response.views.ExcelView
Examples
Function-based views
You can construct your data from a queryset.
from excel_response import ExcelResponse
def excelview(request):
objs = SomeModel.objects.all()
return ExcelResponse(objs)
Or you can construct your data manually.
from excel_response import ExcelResponse
def excelview(request):
data = [
['Column 1', 'Column 2'],
[1,2]
[23,67]
]
return ExcelResponse(data, 'my_data')
Class-based views
These are as simple as import and go!
from excel_response import ExcelView
class ModelExportView(ExcelView):
model = SomeModel
Metadata
Release files for django-excel-response 2.0.5
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-excel-response-2.0.5.tar.gz | 9.0 kB | Without provenance | Details |
Release files / django-excel-response-2.0.5.tar.gz
| Download URL | django-excel-response-2.0.5.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e432c6e10272dcc9795a0f475d97d3cc7a96299b2d5cd97bdf812bbff934d7c
|
|
BLAKE2b-256 checksum How to use checksums |
d1daf254e4e370b555126e6a78364d056beafcd92fe4bb06255f0aa52f832ba1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7
|
Security for django-excel-response 2.0.5
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.