Skip to main content

A collection of DRF mixins combinations

Project description

rest-framework-mixins

Installation

pip install rest_framework_mixins

Usage

This package provides all combinations of the mixins provided by rest_framework.
All combinations follow the same format: `{initials}Mixin.

The initials correspond to the following methods, in this specific order:

  • L: list()
  • R: retrieve()
  • C: create()
  • U: update()
  • P: partial_update()
  • D: delete()

So for example, to import a mixin that gives us list, retrieve and create, we can do the following:

from rest_framework_mixins import LRCMixin

class CreateListRetrieveViewSet(LRCMixin, viewsets.GenericViewSet):
    """
    A viewset that provides `retrieve`, `create`, and `list` actions.

    To use it, override the class and set the `.queryset` and
    `.serializer_class` attributes.
    """
    pass

Adapted from DRF's documentation

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

rest_framework_mixins-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

rest_framework_mixins-1.0.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file rest_framework_mixins-1.0.0.tar.gz.

File metadata

  • Download URL: rest_framework_mixins-1.0.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.7 Linux/6.2.0-1018-azure

File hashes

Hashes for rest_framework_mixins-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f7e4d7115f88031b455b50e56e284657d53ca79fed38df012301cd4af085c74c
MD5 cda8b8b3be462d24135ebc2368903c58
BLAKE2b-256 29f8efaa30b5b7eac786355b6a93dbea9f3581c1c0f23ec8f2e1fcca7656c09e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rest_framework_mixins-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc24a9620ffc6ec1ddf8453ac988b2a0b633d3483124973a3e4503ce7ccdd04e
MD5 5eec59739f2b168d4e7bddba25424214
BLAKE2b-256 1cda69ad672e60521c097c7ce3db35620846799b8bcb2f06ea1c47859f5cc8ff

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