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

Uploaded Source

Built Distribution

rest_framework_mixins-0.1.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rest_framework_mixins-0.1.2.tar.gz
  • Upload date:
  • Size: 4.5 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.2.tar.gz
Algorithm Hash digest
SHA256 d9fff0026d043316ccadaad61817e7effabc9f2eee630d155262de8afe4cb2ed
MD5 6fff39cec1c6d97eb573fd0e419951db
BLAKE2b-256 d8ef01379c6831a5c8f651ec961043160a2e5cc8d038850211d7edace4b279dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rest_framework_mixins-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d6b93bd8d087b3a2932365d4a373e6db6cab7ec4153b4c92b0adff0b3f10f14b
MD5 97587e96b507e5d9562982d7c4f53c57
BLAKE2b-256 a636da5cd725c619e6ac1619fa7ea1cfa301bb1884e9e1d6df3f04b2d3762dbf

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