drf-dynamic-fields
Dynamically return subset of Django REST Framework serializer fields
Decision gist · record as of 2026-08-14
Yes, if you are using Django REST Framework and need simple per-request field filtering. The package has no dependencies, low install friction, and a permissive MIT license. However, the aging maintenance status (last release April 2022) means you should verify compatibility with your Django 2.2 LTS, 3.2 LTS, or 4.0 and DRF 3.8 or 3.9 versions before adopting it.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Django 2.2 LTS, 3.2 LTS, or 4.0; requires Django REST Framework 3.8 or 3.9; request object must be passed to serializer context for the mixin to function.
- Low install friction with no runtime dependencies.
- Package is aging (last release April 2022, 1592 days ago) but marked Production/Stable and the repository remains active and unarchived.
License · maintenance · safety
MIT (permissive) — MIT license is permissive and imposes no restrictions on use, modification, or redistribution in proprietary or open-source projects.
last release 2022-04-05 (1592 days) · last repo commit 2025-07-10 · 262 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 147,910 downloads/mo, #11,049 on PyPI
Alternatives
Verify before relying
pip install drf-dynamic-fields
from drf_dynamic_fields import DynamicFieldsMixin
class MySerializer(DynamicFieldsMixin, serializers.ModelSerializer):
class Meta:
model = MyModel
fields = ('id', 'name', 'email')
# Then use: GET /api/endpoint/?fields=id,name- Whether the package works with Django versions beyond 4.0 or DRF versions beyond 3.9.
- Performance characteristics when filtering large numbers of fields or handling deeply nested serializers.
- Compatibility with Python versions beyond 3.7+.
What it is and what it does
drf-dynamic-fields is a mixin for Django REST Framework serializers that lets API clients control which fields appear in responses via query parameters. Instead of always returning all fields, clients can pass `?fields=id,name` to get only those fields, or `?omit=email` to exclude specific ones. The mixin intercepts the serialization process and dynamically removes unwanted fields before rendering the response.
The package is deliberately minimal—it handles flat field filtering only and does not plan to add support for nested fields. It integrates by inheriting from DynamicFieldsMixin alongside your serializer class, and requires the request object to be available in the serializer's context. The implementation is stable and has been in production use since first release in 2016, though development has slowed (last release in April 2022).
Use it for
- Reduce API response payload size by letting mobile clients request only essential fields over bandwidth-constrained connections.
- Build flexible APIs where frontend teams can request exactly the fields they need without creating multiple endpoints.
- Optimize database query results by excluding heavy computed or related fields that aren't needed for a particular request.
- Support legacy API clients that expect different field subsets without duplicating serializer logic across endpoints.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are using Django REST Framework and need simple per-request field filtering.
The package has no dependencies, low install friction, and a permissive MIT license. However, the aging maintenance status (last release April 2022) means you should verify compatibility with your Django 2.2 LTS, 3.2 LTS, or 4.0 and DRF 3.8 or 3.9 versions before adopting it.
Install
drf-dynamic-fields on PyPI
Before you install
Low install friction with no runtime dependencies. Package is aging (last release April 2022, 1592 days ago) but marked Production/Stable and the repository remains active and unarchived.
Requires Django 2.2 LTS, 3.2 LTS, or 4.0; requires Django REST Framework 3.8 or 3.9; request object must be passed to serializer context for the mixin to function.
License in practice
MIT license is permissive and imposes no restrictions on use, modification, or redistribution in proprietary or open-source projects.
Quickstart
pip install drf-dynamic-fields
from drf_dynamic_fields import DynamicFieldsMixin
class MySerializer(DynamicFieldsMixin, serializers.ModelSerializer):
class Meta:
model = MyModel
fields = ('id', 'name', 'email')
# Then use: GET /api/endpoint/?fields=id,name
Verify before relying
- Whether the package works with Django versions beyond 4.0 or DRF versions beyond 3.9.
- Performance characteristics when filtering large numbers of fields or handling deeply nested serializers.
- Compatibility with Python versions beyond 3.7+.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 1,592 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 147,910 / month, #11,049 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3 |
Evidence: drf_dynamic_fields-0.4.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “drf serializer field filtering”
- drf-dynamic-fieldsProvides a Django REST Framework mixin that lets you dynamically…
- drf-flex-fieldsAdds dynamic field expansion and sparse field selection to Django…
- drf-pydanticBridges pydantic models and Django REST framework by automatically…
Give your agent the search over MCP, or paste the wish link into any chat.
More Dynamic Content packages
MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.
Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.
Soupsieve is a CSS selector library designed to work with Beautiful Soup 4 to select, match, and filter HTML and XML elements using modern CSS selectors from CSS level 1 through CSS level 4 specifications.
Install it if you use Beautiful Soup for HTML or XML parsing and want modern CSS selector support.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
Flask is a lightweight WSGI web application framework for building web applications in Python, from simple single-page sites to complex multi-route applications.
Mako compiles Python-embedded templates into Python modules for fast rendering, supporting layout inheritance, custom functions, and direct Python expressions within template syntax.
See also drf-extra-fields · drf-flex-fields · drf-rw-serializers · drf-extensions · drf-jsonschema-serializer · djangorestframework-recursive · djangorestframework-bulk · drf-recaptcha · django-typomatic · drf-writable-nested