Skip to main content

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


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

django_rest_envelope-1.0.0-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

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