django-localflavor
Country-specific Django helpers
What it is and what it does
django-localflavor is a standalone Django package that provides localized form fields and validators for specific countries and regions. It was originally part of Django's core but was separated to keep the framework lean. The package includes postal code validators, government ID number fields, and other country-specific helpers that integrate seamlessly with Django's form system.
The package depends on Django and python-stdnum for validation logic. It actively supports modern Django versions (4.2 through 6.0) and Python 3.9+. The project is actively maintained with recent releases and regular commits, making it suitable for production use in applications that need localized form handling.
Use it for:
- Validate postal codes in a user registration form for a specific country
- Build a Django form with country-specific government ID number fields for compliance
- Localize form validation rules across a multi-country web application
- Add region-specific address or tax ID validation to checkout flows
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides country-specific form fields, validators, and helpers for Django applications, such as postal code formats and government ID number validation tailored to individual countries.
Yes. The package is actively maintained, has low install friction, carries a permissive license, and solves a real problem for Django applications serving specific countries. Install it when you need country-specific form validation; skip it if your application is country-agnostic or uses a custom validation layer.
Install
django-localflavor on PyPI
pip
pip install django-localflavoruv
uv add django-localflavorpoetry
poetry add django-localflavorInstalling django-localflavor
Before you install
Low install friction with a pure Python wheel. Actively maintained with a recent release (13 days old) and steady commits. Requires Django and python-stdnum as runtime dependencies.
License in practice
BSD-3-Clause permissive license allows use in commercial and private projects with minimal restrictions; attribution required.
Quickstart
pip install django-localflavor
from django_localflavor.us.forms import USStateField
field = USStateField()
Requires Django 4.2, 5.0, 5.1, 5.2, or 6.0; Python 3.9 or later.
Verify before relying
- Which specific countries or regions are currently supported by version 5.1
- Whether breaking data changes in version 5.1 affect existing deployments beyond LV, NP, NO flavors mentioned
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — django, python-stdnum |
| Maintenance | actively maintained — 13 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,029,601/month — #4,473 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_localflavor-5.1-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-countriesProvides a Django model field for storing…
permissive · top 5,000 on PyPI
django-phonenumber-fieldProvides a Django model field for storing,…
permissive · top 5,000 on PyPI
django-settings-holderProvides a settings container for Django…
permissive · top 15,000 on PyPI
google-i18n-addressValidates, normalizes, and formats postal…
permissive · top 15,000 on PyPI
django-timezone-fieldProvides Django database, form, and REST…
permissive · top 5,000 on PyPI
django-stubsProvides type stubs and a mypy plugin to enable…
permissive · top 5,000 on PyPI
django-nineProvides version checking utilities for Django,…
copyleft · top 15,000 on PyPI
drf-recaptchaAdds reCAPTCHA v2 and v3 field validation to…
permissive · top 15,000 on PyPI
django-allow-cidrA Django middleware that extends ALLOWED_HOSTS…
permissive · top 5,000 on PyPI
policyengine-corePolicyEngine Core provides a microsimulation…
agpl · top 15,000 on PyPI