drf-extra-fields
Additional fields for Django Rest Framework.
What it is and what it does
drf-extra-fields extends Django REST Framework with specialized serializer fields that handle use cases not covered by the framework's built-in offerings. It provides base64 image and file fields for encoding/decoding binary data as strings, geographic point fields for latitude/longitude pairs, PostgreSQL-specific range fields (integer, float, decimal, date, datetime), and enhanced relational fields like PresentablePrimaryKeyRelatedField that represent related objects with custom serializers.
The package is designed as a drop-in extension: you import field classes into your serializers and use them like standard DRF fields. It depends on Django, djangorestframework, and filetype for image type detection. Recent versions have modernized the codebase for Python 3.7+, removed unintended dependencies, and added support for psycopg 3 alongside psycopg2.
Use it for:
- Accept base64-encoded image uploads in REST API endpoints and store them as files without multipart form data.
- Serialize geographic coordinates as latitude/longitude dictionaries for location-based APIs.
- Work with PostgreSQL range fields in Django models while maintaining clean serialization in REST APIs.
- Display related objects with full serialized details using PresentablePrimaryKeyRelatedField.
- Build APIs that accept or return files as base64 strings for client-side convenience.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides specialized serializer fields for Django REST Framework, including base64 image/file handling, geographic point fields, PostgreSQL range fields, and enhanced relational fields.
Yes, with conditions. The package fills genuine gaps in DRF's field offerings and has low install friction. However, maintenance is aging—the last release was August 2023—so verify compatibility with your specific Django and DRF versions before adopting. No known security vulnerabilities. Suitable for projects needing base64 file handling, geographic fields, or PostgreSQL range support and tolerating infrequent updates.
Install
drf-extra-fields on PyPI
pip
pip install drf-extra-fieldsuv
uv add drf-extra-fieldspoetry
poetry add drf-extra-fieldsInstalling drf-extra-fields
Before you install
Low install friction with a pure-Python wheel. Maintenance is aging—last release was in August 2023, though the repository remains active with recent commits and no archived status. Depends on Django, djangorestframework, and filetype; psycopg 3 is now supported automatically if available.
License in practice
Licensed under Apache-2.0 (permissive), which allows commercial and private use with minimal restrictions. No notable licensing barriers for most projects.
Quickstart
pip install drf-extra-fields
from drf_extra_fields.fields import Base64ImageField
from drf_extra_fields.geo_fields import PointField
class ImageSerializer:
image = Base64ImageField()
point = PointField()
Requires Django and djangorestframework to be installed; filetype is a runtime dependency for image type detection.
Verify before relying
- Current compatibility with Django versions beyond 4.0 and whether recent DRF releases work without issues.
- Whether the aging maintenance status affects stability or introduces compatibility gaps with recent framework releases.
- Performance characteristics and any known limitations when handling large base64-encoded files.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — Django, djangorestframework, filetype |
| Maintenance | aging — 1,102 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 569,590/month — #5,960 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: drf_extra_fields-3.7.0-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
django-cleanupAutomatically deletes old files when Django…
permissive · top 15,000 on PyPI
drf-dynamic-fieldsProvides a Django REST Framework mixin that…
permissive · top 15,000 on PyPI
djangorestframework-recursiveAdds a RecursiveField to Django REST Framework…
permissive · top 15,000 on PyPI
django-versatileimagefieldExtends Django's ImageField with flexible image…
permissive · top 15,000 on PyPI
django-rest-polymorphicProvides polymorphic serializers for Django…
permissive · top 5,000 on PyPI
rest-framework-generic-relationsProvides Django REST Framework serializers that…
permissive · top 15,000 on PyPI
djangorestframework-dataclassesAutomatically generates Django REST Framework…
permissive · top 5,000 on PyPI
drf-writable-nestedExtends Django REST Framework serializers to…
permissive · top 15,000 on PyPI
djangorestframework-xmlAdds XML parsing and rendering support to…
permissive · top 15,000 on PyPI
djangorestframework-yamlAdds YAML parsing and rendering support to…
permissive · top 15,000 on PyPI