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-0.1.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

rest_framework_mixins-0.1.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rest_framework_mixins-0.1.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Linux/5.15.0-1031-azure

File hashes

Hashes for rest_framework_mixins-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b8d43816a6f39da833a34b9963f3579d842d643b324553eff2733bc83caaacbf
MD5 0ab738b7a6f7719317802cdddba06657
BLAKE2b-256 cc73b2a3d6f304360486dc737bbc4c640b53e51a9d5ac62fe44494d4185683ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rest_framework_mixins-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1109f82d21f16611a43071cfd83c964e66e59a844ed948b3ff7f28ca121a6d28
MD5 15b73b7eeb4784c7c913565ff01638b9
BLAKE2b-256 a759e666c940a48d3ac905af01fe22af6074ab23b3174c382c801f5724beb497

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