skillfed

django-timezone-field

A Django app providing DB, form, and REST framework fields for zoneinfo and pytz timezone objects.

django-timezone-field v7.2.2 8.8M downloads/30d#1,592 on PyPI414
Permissive license BSD-2-Clause Active released

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

uv

uv add django-timezone-field

poetry

poetry add django-timezone-field

Installing 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

Development Status :: 4 - BetaEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Framework :: Django :: 6.1Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Utilities

Tags

django timezone fieldzoneinfo django modeltimezone form field djangopytz django integrationrest framework timezone serializerdjango timezone database fieldtimezone choice field
django-ormtimezone-handling

More Utilities packages