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.

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

Renderers

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's Queryset 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

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.