django-timezone-field
A Django app providing DB, form, and REST framework fields for zoneinfo and pytz timezone objects.
What it is and what it does
django-timezone-field bridges Django models, forms, and REST serializers with Python's timezone handling, letting you store timezone identifiers in the database and retrieve them as either zoneinfo or pytz objects. It handles the transition from pytz to zoneinfo by supporting both, with defaults that follow Django's own deprecation timeline: zoneinfo is the default for Django 4.0+, while Django 5.0+ drops pytz support entirely and this package follows suit.
The package stores timezone values as strings in the database but automatically converts them to timezone objects on retrieval, validates against known timezone names, and renders timezone choices in forms with optional GMT offset display. It works across Django's ORM, form validation, and Django REST Framework serialization without requiring data migrations when switching between pytz and zoneinfo.
Use it for:
- Store user or location timezone preferences in a Django model and retrieve them as timezone objects for datetime operations.
- Build a form or API endpoint where users select their timezone from a validated dropdown or choice field.
- Migrate an existing Django project from pytz to zoneinfo while keeping the same database schema and field behavior.
- Display timezone choices with GMT offsets in admin or user-facing forms for clarity (e.g., 'GMT+04:00 Asia/Dubai').
- Serialize timezone data in Django REST Framework APIs, accepting and returning timezone identifiers as strings.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Django database, form, and REST framework fields for storing and working with timezone objects using either the standard library's zoneinfo or the legacy pytz library.
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real Django need—timezone field handling—across models, forms, and REST APIs. It cleanly handles the pytz-to-zoneinfo transition and is compatible with current Django versions (4.2 through 6.1). Install it if you need timezone storage and validation in Django.
Install
django-timezone-field on PyPI
pip
pip install django-timezone-fielduv
uv add django-timezone-fieldpoetry
poetry add django-timezone-fieldInstalling django-timezone-field
Before you install
Low friction: pure Python wheel with only Django and backports.zoneinfo as runtime dependencies. Actively maintained with recent releases supporting Django 6.1 and Python 3.14.
License in practice
BSD-2-Clause permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install django-timezone-field
from django.db import models
class MyModel(models.Model):
tz = TimeZoneField(default="UTC")
my_model = MyModel()
my_model.tz # returns zoneinfo.ZoneInfo object by default
Requires Django 4.2 or later; if using pytz instead of zoneinfo, pytz must be installed separately.
Verify before relying
- Whether tzdata package is automatically installed or must be added separately for full IANA timezone coverage on systems with incomplete timezone databases.
Package facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — Django, backports.zoneinfo |
| Maintenance | actively maintained — 69 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 8,827,989/month — #1,592 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_timezone_field-7.2.2-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytzpytz brings the Olson timezone database into…
permissive · top 100 on PyPI
pytzdataProvides access to the Olson timezone database…
permissive · top 5,000 on PyPI
backports.zoneinfoProvides IANA time zone support for Python…
permissive · top 5,000 on PyPI
tzfpyConverts geographic coordinates…
permissive · top 5,000 on PyPI
pytz-deprecation-shimProvides drop-in timezone shims that support…
permissive · top 5,000 on PyPI
DateTimeProvides a DateTime data type for working with…
unclear · top 5,000 on PyPI
tzlocalReturns the IANA timezone name and tzinfo…
permissive · top 1,000 on PyPI
django-localflavorProvides country-specific form fields,…
permissive · top 5,000 on PyPI
l18nProvides lazy translations for timezone and…
permissive · top 15,000 on PyPI
tzdataProvides IANA time zone data as a Python…
permissive · top 100 on PyPI