21 KiB
Third Party Packages
Software ecosystems […] establish a community that further accelerates the sharing of knowledge, content, issues, expertise and skills.
— Jan Bosch.
About Third Party Packages
Third Party Packages allow developers to share code that extends the functionality of Django REST framework, in order to support additional use-cases.
We support, encourage and strongly favor the creation of Third Party Packages to encapsulate new behavior rather than adding additional functionality directly to Django REST Framework.
We aim to make creating third party packages as easy as possible, whilst keeping a simple and well maintained core API. By promoting third party packages we ensure that the responsibility for a package remains with its author. If a package proves suitably popular it can always be considered for inclusion into the core REST framework.
If you have an idea for a new feature please consider how it may be packaged as a Third Party Package. We're always happy to discuss ideas on the Mailing List.
Creating a Third Party Package
Version compatibility
Sometimes, in order to ensure your code works on various different versions of Django, Python or third party libraries, you'll need to run slightly different code depending on the environment. Any code that branches in this way should be isolated into a compat.py
module, and should provide a single common interface that the rest of the codebase can use.
Check out Django REST framework's compat.py for an example.
Once your package is available
Once your package is decently documented and available on PyPI, you might want share it with others that might find it useful.
Adding to the Django REST framework grid
We suggest adding your package to the REST Framework grid on Django Packages.
Adding to the Django REST framework docs
Create a Pull Request or Issue on GitHub, and we'll add a link to it from the main REST framework documentation. You can add your package under Third party packages of the API Guide section that best applies, like Authentication or Permissions. You can also link your package under the Third Party Packages section.
Announce on the discussion group.
You can also let others know about your package through the discussion group.
Existing Third Party Packages
Django REST Framework has a growing community of developers, packages, and resources.
Check out a grid detailing all the packages and ecosystem around Django REST Framework at Django Packages.
To submit new content, open an issue or create a pull request.
Async Support
- adrf - Async support, provides async Views, ViewSets, and Serializers.
Authentication
- djangorestframework-digestauth - Provides Digest Access Authentication support.
- django-oauth-toolkit - Provides OAuth 2.0 support.
- djangorestframework-simplejwt - Provides JSON Web Token Authentication support.
- hawkrest - Provides Hawk HTTP Authorization.
- djangorestframework-httpsignature - Provides an easy to use HTTP Signature Authentication mechanism.
- djoser - Provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation.
- dj-rest-auth - Provides a set of REST API endpoints for registration, authentication (including social media authentication), password reset, retrieve and update user details, etc.
- drf-oidc-auth - Implements OpenID Connect token authentication for DRF.
- drfpasswordless - Adds (Medium, Square Cash inspired) passwordless logins and signups via email and mobile numbers.
- django-rest-authemail - Provides a RESTful API for user signup and authentication using email addresses.
Permissions
- drf-any-permissions - Provides alternative permission handling.
- djangorestframework-composed-permissions - Provides a simple way to define complex permissions.
- rest_condition - Another extension for building complex permissions in a simple and convenient way.
- dry-rest-permissions - Provides a simple way to define permissions for individual api actions.
- drf-access-policy - Declarative and flexible permissions inspired by AWS' IAM policies.
- drf-psq - An extension that gives support for having action-based permission_classes, serializer_class, and queryset dependent on permission-based rules.
Serializers
- django-rest-framework-mongoengine - Serializer class that supports using MongoDB as the storage layer for Django REST framework.
- djangorestframework-gis - Geographic add-ons
- djangorestframework-hstore - Serializer class to support django-hstore DictionaryField model field and its schema-mode feature.
- djangorestframework-jsonapi - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.
- html-json-forms - Provides an algorithm and serializer to process HTML JSON Form submissions per the (inactive) spec.
- django-rest-framework-serializer-extensions - Enables black/whitelisting fields, and conditionally expanding child serializers on a per-view/request basis.
- djangorestframework-queryfields - Serializer mixin allowing clients to control which fields will be sent in the API response.
- drf-flex-fields - Serializer providing dynamic field expansion and sparse field sets via URL parameters.
- drf-action-serializer - Serializer providing per-action fields config for use with ViewSets to prevent having to write multiple serializers.
- djangorestframework-dataclasses - Serializer providing automatic field generation for Python dataclasses, like the built-in ModelSerializer does for models.
- django-restql - Turn your REST API into a GraphQL like API(It allows clients to control which fields will be sent in a response, uses GraphQL like syntax, supports read and write on both flat and nested fields).
- graphwrap - Transform your REST API into a fully compliant GraphQL API with just two lines of code. Leverages Graphene-Django to dynamically build, at runtime, a GraphQL ObjectType for each view in your API.
Serializer fields
- drf-compound-fields - Provides "compound" serializer fields, such as lists of simple values.
- drf-extra-fields - Provides extra serializer fields.
- django-versatileimagefield - Provides a drop-in replacement for Django's stock
ImageField
that makes it easy to serve images in multiple sizes/renditions from a single field. For DRF-specific implementation docs, click here.
Views
- django-rest-multiple-models - Provides a generic view (and mixin) for sending multiple serialized models and/or querysets via a single API request.
- drf-typed-views - Use Python type annotations to validate/deserialize request parameters. Inspired by API Star, Hug and FastAPI.
- rest-framework-actions - Provides control over each action in ViewSets. Serializers per action, method.
Routers
- drf-nested-routers - Provides routers and relationship fields for working with nested resources.
- wq.db.rest - Provides an admin-style model registration API with reasonable default URLs and viewsets.
Parsers
- djangorestframework-msgpack - Provides MessagePack renderer and parser support.
- djangorestframework-jsonapi - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.
- djangorestframework-camel-case - Provides camel case JSON renderers and parsers.
- nested-multipart-parser - Provides nested parser for http multipart request
Renderers
- djangorestframework-csv - Provides CSV renderer support.
- djangorestframework-jsonapi - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.
- drf_ujson2 - Implements JSON rendering using the UJSON package.
- rest-pandas - Pandas DataFrame-powered renderers including Excel, CSV, and SVG formats.
- djangorestframework-rapidjson - Provides rapidjson support with parser and renderer.
Filtering
- djangorestframework-chain - Allows arbitrary chaining of both relations and lookup filters.
- django-url-filter - Allows a safe way to filter data via human-friendly URLs. It is a generic library which is not tied to DRF but it provides easy integration with DRF.
- drf-url-filter is a simple Django app to apply filters on drf
ModelViewSet
'sQueryset
in a clean, simple and configurable way. It also supports validations on incoming query params and their values. - django-rest-framework-guardian2 - Provides integration with django-guardian, including the
DjangoObjectPermissionsFilter
previously found in DRF.
Misc
- drf-sendables - User messages for Django REST Framework
- cookiecutter-django-rest - A cookiecutter template that takes care of the setup and configuration so you can focus on making your REST apis awesome.
- djangorestrelationalhyperlink - A hyperlinked serializer that can can be used to alter relationships via hyperlinks, but otherwise like a hyperlink model serializer.
- django-rest-framework-proxy - Proxy to redirect incoming request to another API server.
- gaiarestframework - Utils for django-rest-framework
- drf-extensions - A collection of custom extensions
- ember-django-adapter - An adapter for working with Ember.js
- django-versatileimagefield - Provides a drop-in replacement for Django's stock
ImageField
that makes it easy to serve images in multiple sizes/renditions from a single field. For DRF-specific implementation docs, click here. - drf-tracking - Utilities to track requests to DRF API views.
- drf_tweaks - Serializers with one-step validation (and more), pagination without counts and other tweaks.
- django-rest-framework-braces - Collection of utilities for working with Django Rest Framework. The most notable ones are FormSerializer and SerializerForm, which are adapters between DRF serializers and Django forms.
- drf-haystack - Haystack search for Django Rest Framework
- django-rest-framework-version-transforms - Enables the use of delta transformations for versioning of DRF resource representations.
- django-rest-messaging, django-rest-messaging-centrifugo and django-rest-messaging-js - A real-time pluggable messaging service using DRM.
- djangorest-alchemy - SQLAlchemy support for REST framework.
- djangorestframework-datatables - Seamless integration between Django REST framework and Datatables.
- django-rest-framework-condition - Decorators for managing HTTP cache headers for Django REST framework (ETag and Last-modified).
- django-rest-witchcraft - Provides DRF integration with SQLAlchemy with SQLAlchemy model serializers/viewsets and a bunch of other goodies
- djangorestframework-mvt - An extension for creating views that serve Postgres data as Map Box Vector Tiles.
- drf-viewset-profiler - Lib to profile all methods from a viewset line by line.
- djangorestframework-features - Advanced schema generation and more based on named features.
- django-elasticsearch-dsl-drf - Integrate Elasticsearch DSL with Django REST framework. Package provides views, serializers, filter backends, pagination and other handy add-ons.
- django-api-client - DRF client that groups the Endpoint response, for use in CBVs and FBV as if you were working with Django's Native Models..
- fast-drf - A model based library for making API development faster and easier.
- django-requestlogs - Providing middleware and other helpers for audit logging for REST framework.
- drf-standardized-errors - DRF exception handler to standardize error responses for all API endpoints.
- drf-api-action - uses the power of DRF also as a library functions
Customization
- drf-redesign - A project that gives a fresh look to the browse-able API using Bootstrap 5.
- drf-material - A project that gives a sleek and elegant look to the browsable API using Material Design.