skillfed

drf-extra-fields

Additional fields for Django Rest Framework.

drf-extra-fields v3.7.0 569.6K downloads/30d#5,960 on PyPI688
Permissive license Apache-2.0 AGING released

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-fields

uv

uv add drf-extra-fields

poetry

poetry add drf-extra-fields

Installing 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

Environment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Dynamic Content

Tags

django rest framework custom fieldsbase64 image serializationdrf extra serializer fieldsdjango rest framework extensionsgeographic point field djangopostgresql range fields drffile upload base64 encoding
django-rest-frameworkserializationgeospatial

More WWW/HTTP packages

urllib3

urllib3 is an HTTP client library that provides…

permissive · top 100 on PyPI

requests

Requests is a Python HTTP library that…

permissive · top 100 on PyPI

h11

h11 is a pure-Python HTTP/1.1 protocol…

permissive · top 100 on PyPI

httpx

HTTPX is a fully featured HTTP client library…

permissive · top 100 on PyPI

httpcore

A minimal low-level HTTP client library that…

permissive · top 100 on PyPI

aiohttp

aiohttp is an async HTTP client and server…

permissive · top 100 on PyPI

django-cleanup

Automatically deletes old files when Django…

permissive · top 15,000 on PyPI

drf-dynamic-fields

Provides a Django REST Framework mixin that…

permissive · top 15,000 on PyPI

djangorestframework-recursive

Adds a RecursiveField to Django REST Framework…

permissive · top 15,000 on PyPI

django-versatileimagefield

Extends Django's ImageField with flexible image…

permissive · top 15,000 on PyPI

django-rest-polymorphic

Provides polymorphic serializers for Django…

permissive · top 5,000 on PyPI

rest-framework-generic-relations

Provides Django REST Framework serializers that…

permissive · top 15,000 on PyPI

djangorestframework-dataclasses

Automatically generates Django REST Framework…

permissive · top 5,000 on PyPI

drf-writable-nested

Extends Django REST Framework serializers to…

permissive · top 15,000 on PyPI

djangorestframework-xml

Adds XML parsing and rendering support to…

permissive · top 15,000 on PyPI

djangorestframework-yaml

Adds YAML parsing and rendering support to…

permissive · top 15,000 on PyPI