Skip to main content

A Django REST Framework package allowing views to be rendered as CSV or XLSX

Project description

Django REST Spreadsheets renderer

This project pulls work from drf-renderer-xlsx and django-rest-framework-csv aiming to combine these renders into a single package while fixing some of their individual quirks.

Differences

An important use case for file export in a RESTful API is to allow the user to manipulate data using their own tools. While pagination is useful for endpoints where you don't need to see all the data, they don't make sense for these types of file export. This project will handle pagination by ignoring it, serializing the entire queryset.


In addition, to enable CSV/XLSX on an endpoint, all that needs to be done is adding a single mixin like such:

from drf_spreadsheets.mixins import SpreadsheetMixIn

class YourViewSet(SpreadsheetMixIn, ModelViewSet):
    ...

This instead of manually overriding renderer_classes, or adding the renderer to the defaults. The former is clunky and can lead to unwanted behavior and the latter is rarely necessary since there will be many endpoints that don't need spreadsheet exports in most projects.


One regression is in XLSX styling. For the initial version of this package, no styling can be applied to generated XLSX files. Since this is not an essential feature for most export use-cases, it has been left as a potential future feature

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

drf-spreadsheets-jpaavola-1.0.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file drf-spreadsheets-jpaavola-1.0.0.tar.gz.

File metadata

  • Download URL: drf-spreadsheets-jpaavola-1.0.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for drf-spreadsheets-jpaavola-1.0.0.tar.gz
Algorithm Hash digest
SHA256 34eef9bcaef56c10cca4f62368789e5fc387dd09a7fbc156f970cc3660fd9742
MD5 c8d4a599cd009f931fdfa5985491cde4
BLAKE2b-256 d1f4240907ee5137f77f313b4d64afa1baf29632d7d28bff346732ebd79b6acb

See more details on using hashes here.

File details

Details for the file drf_spreadsheets_jpaavola-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: drf_spreadsheets_jpaavola-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for drf_spreadsheets_jpaavola-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c98d69eba7628c1e3d5504cc9ca872b361370b0a3a80802cd98f0a7c2feccf4d
MD5 aa3399de93ba55475ec624abda060f15
BLAKE2b-256 210c4150d3200af92703879d7c29e20c0bb51b38e2fb260be118a5576b387a99

See more details on using hashes here.

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