A function extends of Tarken's django-excel-response
Project description
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. All of this is done in-memory and on-the-fly, with no disk writes, thanks to the StringIO library.
DjangoSnippets - http://djangosnippets.org/snippets/1151/
PyPI - https://pypi-hypernode.com/pypi/django-excel-response/1.0
django-excel-response2
When using Tarken’s django-excel-response. We find that Chinese is messed code when we open .xls in Mac OS. As discussed in http://segmentfault.com/q/1010000000095546. We realize django-excel-response2 Based on Tarken’s django-excel-response to solve this problem By adding a Param named font to set font.
At The Same Time:
- Fix Bug
can’t subtract offset-naive and offset-aware datetimes
Installation
pip install django-excel-response2
Usage
from excel_response2 import ExcelResponse def excelview(request): objs = SomeModel.objects.all() return ExcelResponse(objs)
or:
from excel_response2 import ExcelResponse def excelview(request): data = [ ['Column 1', 'Column 2'], [1, 2], [3, 4] ] return ExcelResponse(data, 'my_data', font='name SimSum')
Params
- font=’name SimSum’
Set Font as SimSum(宋体)
- force_csv=True
CSV Format? True for Yes, False for No, Default is False
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
Built Distribution
File details
Details for the file django-excel-response2-2.0.1.tar.gz
.
File metadata
- Download URL: django-excel-response2-2.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10c9571e0de3a6bfaa38e5cd6ac75490521c29d009bbe84511773039ccdcaf0f |
|
MD5 | f1786da72156e872dd150dc68f5eb34e |
|
BLAKE2b-256 | 739ef9ff509919f691ecd1396a802cdbbaac90ecc79fe1033ba11447e2b828ee |
File details
Details for the file django_excel_response2-2.0.1-py2.7.egg
.
File metadata
- Download URL: django_excel_response2-2.0.1-py2.7.egg
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f19953007f62fdbd3aba158b906611faa580ea7129a12c6a49284e45592a51d1 |
|
MD5 | 7c1da43a46cd0720007e0171b47e8805 |
|
BLAKE2b-256 | 17c34edee361ce4661fe98e569d2bdda1285bd8f879fe897b364435d69cec648 |