Skip to main content

A Django app to generate CSV reports for QuerySet data

Project description

Django CSV Generator

A Django application containing CsvGenerator base class to be used with Django QuerySet to generate CSV report for list of objects, preferably Django models.

Features

  • Can return HTTP response containing generated CSV file.
  • Convenient to use with Django admin actions.

Installation

  1. Install package in your project: pip install dj-csv-generator
  2. Add 'csv_generator' to INSTALLED_APPS in your settings.py
  3. In your code import base generator class: from csv_generator.generator import CsvGenerator
  4. Create your own CSV generator class derived from CsvGenerator and customize it. You can use project/example as reference.
  5. Use your generator to generate CSV file:
generator = YourCsvGeneratorClass()

# if you need plain text data, use:
rows = generator.process_data(YourDjangoModel.objects.all())

# if you need HttpResponse, for example to return in your view, use:
response = generator.get_response(YourDjangoModel.objects.all())

Generator options and use cases

...In progress...

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

dj_csv_generator-0.2.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file dj_csv_generator-0.2.tar.gz.

File metadata

  • Download URL: dj_csv_generator-0.2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for dj_csv_generator-0.2.tar.gz
Algorithm Hash digest
SHA256 8164d0b37a3c9229f9649940a7730bce5996e3a2ec7447410f4f6794b9481b25
MD5 606f7ff884ac4c3316c3e41fd5cefc35
BLAKE2b-256 e9e0517d081e1a3c1d400b995df697e9fcd401f59791e75eb0b2574a96ec7330

See more details on using hashes here.

Supported by

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