Skip to main content

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

Release files for drf-spreadsheets-jpaavola 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drf-spreadsheets-jpaavola 1.0.0
File Size Uploaded
drf-spreadsheets-jpaavola-1.0.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drf-spreadsheets-jpaavola 1.0.0
File Interpreter ABI Platform
drf_spreadsheets_jpaavola-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / drf-spreadsheets-jpaavola-1.0.0.tar.gz

Download URL drf-spreadsheets-jpaavola-1.0.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
34eef9bcaef56c10cca4f62368789e5fc387dd09a7fbc156f970cc3660fd9742
BLAKE2b-256 checksum
How to use checksums
d1f4240907ee5137f77f313b4d64afa1baf29632d7d28bff346732ebd79b6acb
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / drf_spreadsheets_jpaavola-1.0.0-py3-none-any.whl

Download URL drf_spreadsheets_jpaavola-1.0.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c98d69eba7628c1e3d5504cc9ca872b361370b0a3a80802cd98f0a7c2feccf4d
BLAKE2b-256 checksum
How to use checksums
210c4150d3200af92703879d7c29e20c0bb51b38e2fb260be118a5576b387a99
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page