Metadata-Version: 2.1
Name: django-rest-envelope
Version: 1.0.0
Summary: A mixin for Django REST package List Views to return an object instead of a list.
Author-email: Ferran Jovell <ferran.jovell+gh@gmail.com>
Project-URL: homepage, https://github.com/mrswats/django-rest-envelope
Project-URL: Bug Tracker, https://github.com/mrswats/django-rest-envelope/issues
Keywords: django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENCE
Requires-Dist: Django (>=3.2.14)
Requires-Dist: djangorestframework (>=3.11.0)
Provides-Extra: test
Requires-Dist: pre-commit ; extra == 'test'
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-django ; extra == 'test'

# 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:

```python
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](./LICENCE).
