A mixin for Django REST package List Views to return an object instead of a list.
Project description
Django REST Envelop
Turn the ViewSet list endpoints to return an object rather than a list directly.
Installation
From PYPi using pip
:
pip install django-rest-envelope
Usage
In your viewset views, you can use the ListEnvelopeMixin
along with another mixin that defines the list()
method:
class MyViewSet(ListEnvelopeMixin, ReadOnlyModelViewSet):
envelope: "my_envelope"
In your ViewSet class that uses the mixin you have to define the envelope
attribute.
Additionally, you can overwrite the get_envelope()
method to tweak the behaviour of
which envelope use in different situations.
Licence
This package is distributed under MIT Licence.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for django_rest_envelope-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b967df33430fc15c5dcd2deef979ca5cae4c114c58675f71fb43aa8f95b2cb8 |
|
MD5 | 4931c420a6add149cf6755d13b61e3fb |
|
BLAKE2b-256 | 82a8a96e1a41ff57305d22fd64a9a3af96f76ae9039b3353b112e8ae2dc6e695 |