Django-admin-action to export items as csv-formatted data.
Project description
Description
Django-admin-csvexport is a django-admin-action, that allows you to export the items of your django-admin changelist as csv-formatted data.
Features
selectable model-fields
related models included
customizable csv-format
view or download csv-data
Installation
Install from pypi.org:
pip install django-admin-csvexport
Add csvexport to your installed apps:
INSTALLED_APPS = [ 'csvexport', ... ]
Add csvexport to the actions of your modeladmin:
from csvexport.actions import csvexport class MyModelAdmin(admin.ModelAdmin): ... actions = [csvexport]
Configuration
The following settings determine the depth of the model references and the value to display for empty fields:
CSV_EXPORT_REFERENCE_DEPTH = 3 CSV_EXPORT_EMPTY_VALUE = ''
The following settings define the csv-format to be used. The default values meet the unix standard csv-format:
CSV_EXPORT_DELIMITER = ',' CSV_EXPORT_ESCAPECHAR = '' CSV_EXPORT_QUOTECHAR = '"' CSV_EXPORT_DOUBLEQUOTE = True CSV_EXPORT_LINETERMINATOR = r'\n' CSV_EXPORT_QUOTING = 'QUOTE_ALL'
For the newline escape sequence use a raw-string.
For CSV_EXPORT_QUOTING
use the name of one of these csv module
constants:
The csv-format can also be adjusted by the formular rendered by the csvexport admin-action. If there is no need to adjust the csv-format on each export use:
CSV_EXPORT_FORMAT_FORM = False
Usage
Just use it as any django-admin-action: Select your items, choose csvexport from the admin-action-bar and go. You will be led to a formular that allows you to view or download your items as csv-data.
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
Hashes for django-admin-csvexport-1.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d54780f20de3b2904349028c373dcdf7260add791b79f483c42ba5258a339093 |
|
MD5 | 5c139a26d302e4609395ffd9bce92151 |
|
BLAKE2b-256 | 73631e1ca2b8d7a3e342c7e4a3bfac4f155e71566b4188685f6806c8ae61ce22 |
Hashes for django_admin_csvexport-1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcc8099782e66cdc9e29a87e4833146ddb923e65dbf1817601284c7274b0bd32 |
|
MD5 | 48c23ce4f4636ca14730b58f4ef30c97 |
|
BLAKE2b-256 | 407ef028ebdb80b345e8e4912a0ac12206e864055a5ac8dccb08912e173d536d |