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.5.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

django_admin_csvexport-1.5-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file django-admin-csvexport-1.5.tar.gz.

File metadata

  • Download URL: django-admin-csvexport-1.5.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for django-admin-csvexport-1.5.tar.gz
Algorithm Hash digest
SHA256 c80c768fc9d81d4c8ac8400d593b5f5933826b4e57bf8221a93309b60778aec0
MD5 897bafa7b1933d1431ca66163838551d
BLAKE2b-256 71c924109c0cf86d5fb0ca1ec6ee50cf3f767fb6580da1b8dcf63e9f88b04b7b

See more details on using hashes here.

File details

Details for the file django_admin_csvexport-1.5-py3-none-any.whl.

File metadata

  • Download URL: django_admin_csvexport-1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for django_admin_csvexport-1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8fd0c6e0cf5fc2acd43c10be849958b792ac38223d1400484d2b4df8300ea24c
MD5 901b45a9ba429f9cece3181ba4b956a4
BLAKE2b-256 c2ac255aff0bcacaf3a4b5ecd4073254e0f111bff3a0dcc404461c8224007568

See more details on using hashes here.

Supported by

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