Easily create XLSX documents with Django
Project description
This is a wrapper for openpyxl which makes creating XLSX documents with the purpose of exporting data less boring:
from xlsxdocument import XLSXDocument def xlsx_export(request): some_data = Bla.objects.all() xlsx = XLSXDocument() xlsx.table_from_queryset(Bla.objects.all()) return xlsx.to_response('bla.xlsx')
Adding in additional cells at the end is also possible:
xlsx = XLSXDocument() xlsx.table_from_queryset( Bla.objects.all(), additional=[( 'Full URL', lambda instance: 'http://example.com%s' % ( instance.get_absolute_url(), ), )], )
You can also easily add the facility to export rows to Django’s administration interface:
from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from xlsxdocument import export_selected from app import models class AttendanceAdmin(admin.ModelAdmin): list_filter = ('event',) actions = (export_selected,) admin.site.register(models.Event) admin.site.register(models.Attendance, AttendanceAdmin)
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
xlsxdocument-1.1.0.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for xlsxdocument-1.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28c1a841ac25c70e4f9387ebef1ddd19638aca59dc6055c9dbb01068f790e513 |
|
MD5 | 8c49132ff24b40bfc9a8718df7cb6d69 |
|
BLAKE2b-256 | fb6ec45cfb548ffdf4183cfeb8e6d41c46510cccb19c9a3d03003cec2aa15678 |