drf-extensions
Extensions for Django REST Framework
What it is and what it does
drf-extensions is a collection of add-ons for Django REST Framework that fills gaps in the core framework's API design and performance tooling. It provides mixins to use different serializers for list vs. detail views, decorators for HTTP caching and conditional requests, utilities for constructing cache keys, support for nested routes, and helpers for bulk create/update/delete operations. The package is built on top of djangorestframework, packaging, and Django itself, so it integrates directly into your existing DRF viewsets and serializers.
The package is mature and actively maintained, with a long release history since 2013 and recent updates. It's tested against a wide range of Python and Django versions, making it a stable choice for projects that need these common REST API patterns without rolling custom code.
Use it for:
- Use different serializers for list endpoints versus detail endpoints with a mixin.
- Cache API responses conditionally based on HTTP headers and request state to reduce database load.
- Implement bulk create, update, or delete operations on collections in a single request.
- Define nested resource routes without manual URL configuration.
- Customize cache key construction to handle complex cache invalidation scenarios.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides mixins, decorators, and utilities that extend Django REST Framework's serializers, viewsets, and caching to support detail serializers, bulk operations, nested routes, and conditional requests.
Yes. drf-extensions is a stable, actively maintained library that solves real problems in Django REST Framework projects—detail serializers, caching, bulk operations, and nested routes are common needs. Low install friction, no security vulnerabilities, permissive license, and broad version support make it a safe addition to any DRF-based API.
Install
drf-extensions on PyPI
pip
pip install drf-extensionsuv
uv add drf-extensionspoetry
poetry add drf-extensionsInstalling drf-extensions
Before you install
Low friction install with a pure Python wheel. Actively maintained as of 2026-08-06, tested against modern Python (3.9, 3.10, 3.11, 3.12, 3.13, 3.14) and Django/DRF versions (Django 3.2 to 6.0, DRF 3.12, 3.13, 3.14, 3.15, 3.16). No known security vulnerabilities.
License in practice
BSD license is permissive; you can use, modify, and distribute this package with minimal legal constraints in most commercial and open-source contexts.
Quickstart
pip install drf-extensions
from drf_extensions.mixins import DetailSerializerMixin
from djangorestframework import viewsets
class MyViewSet(DetailSerializerMixin, viewsets.ModelViewSet):
serializer_class = MySerializer
serializer_detail_class = MyDetailSerializer
Verify before relying
- Whether caching and conditional request features work with all cache backends or only specific ones.
- Performance impact of nested routes and bulk operations on large datasets.
- Compatibility with third-party DRF packages beyond those explicitly tested.
- Exact module paths and import patterns for all extension features.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — djangorestframework, packaging, Django |
| Maintenance | actively maintained — 491 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,684,753/month — #2,939 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: drf_extensions-0.8.0-py2.py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
drf-rw-serializersExtends Django REST Framework with separate…
permissive · top 15,000 on PyPI
drf-dynamic-fieldsProvides a Django REST Framework mixin that…
permissive · top 15,000 on PyPI
django-dynamic-preferencesStores and retrieves application settings…
permissive · top 15,000 on PyPI
drf-spectacular-jsonapiGenerates OpenAPI 3 schemas for Django REST…
permissive · top 15,000 on PyPI
djangorestframework-recursiveAdds a RecursiveField to Django REST Framework…
permissive · top 15,000 on PyPI
djangorestframework-role-filtersAdds role-based access control to Django REST…
permissive · top 5,000 on PyPI
djangorestframework-bulkAdds bulk create, update, and delete operations…
permissive · top 15,000 on PyPI
drf-writable-nestedExtends Django REST Framework serializers to…
permissive · top 15,000 on PyPI
drf-nested-routersProvides routers and serializer fields for…
permissive · top 5,000 on PyPI
django-bracesProvides reusable mixin classes for Django…
permissive · top 15,000 on PyPI