Skip to main content

Django-admin-action to export items as csv-formatted data.

Project description

https://travis-ci.com/thomst/django-admin-csvexport.svg?branch=master https://coveralls.io/repos/github/thomst/django-admin-csvexport/badge.svg?branch=master python: 3.4, 3.5, 3.6, 3.7, 3.8 django: 1.11, 2.0, 2.1, 2.2, 3.0

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 = ''

Those 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'

(Use a raw-string for newline escape sequences.)

Per default the csv-format can be adjusted by a formular when generating the csv-file. Set the following setting to False to not render such form:

CSV_EXPORT_FORMAT_FORM = True

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 render your items as csv-data.

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

django-admin-csvexport-1.4.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

django_admin_csvexport-1.4-py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page