A Django library for exporting data.
Project description
django-excel-export
A Django library for exporting data in xlsx, xls, docx format.
- User: admin
- Password: admin
How to install
$ pip install excel-exporter
How to use
Export is achieved by subclassing ExportAdmin, which implements export as an admin action.
# app/admin.py
from excel_exporter.admin import ExportAdmin
class PersonAdmin(ExportAdmin):
list_display = ( 'name', 'address', ...)
export_fields = ('name', 'address', ...)
What you get
You can define custom export action and add it to export_actions list:
# app/admin.py
from excel_exporter.admin import ExportAdmin
from excel_exporter.action import Docx
class PersonExportDocx(Docx):
desc = 'persons to docx'
tpl = 'persons.docx'
queryset_name = 'ps'
def get_payloads(self, queryset, list_display):
payload = super().get_payloads(queryset, list_display)
payload['test'] = 'A Big Company'
payload['logo'] = 'staticfiles/1.jpg'
return payload
class PersonaAdmin(ExportAdmin):
list_display = ( 'name', 'address', ...)
export_actions = [PersonExportDocx, ...]
What you get
See admin.py in Demo Source Code.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
excel-exporter-0.1.3.tar.gz
(18.9 kB
view hashes)
Built Distribution
Close
Hashes for excel_exporter-0.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb115bbc6f97429704ded3e9e522a2103f537038e8721fc2a33f9a797fe8f774 |
|
MD5 | 223f9da3382da98f6f9b1a2056cc0147 |
|
BLAKE2b-256 | 9b39b72f354299f2cc764375fc9c6c8b52372397ef5beff63841cbf7f80fcc9b |