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.
This is http://djangosnippets.org/snippets/1151/ uploaded to pypi. Author is Tarken.
Installation
pip install django-excel-response xlwt
Usage
from excel_response import ExcelResponse
def excelview(request):
objs = SomeModel.objects.all()
return ExcelResponse(objs)
or:
from excel_response import ExcelResponse
def excelview(request):
data = [
['Column 1', 'Column 2'],
[1,2]
[23,67]
]
return ExcelResponse(data, 'my_data')
http://bitbucket.org/kmike/django-excel-response/src
Читайте також:
- Fix Django 1.4 admin_site ForeignKeyRawIdWidget issue
- Django suit admin inline pagination
- Retrieving elements in a specific order in django
- django-stdimage traceback "The '%s' attribute has no file associated with it"
- django-mptt деревоподібний select
- MemcachedKeyLengthError: Key length is > 250
- django postgresql та SCHEMA для таблиць
- Django yandex and google maps integration
- Django admin filter by ranges of dates with calendar