Description
======================== django-phonenumber-field ======================== .. image:: https://github.com/stefanfoulis/django-phonenumber-field/workflows/Test/badge.svg :target: https://github.com/stefanfoulis/django-phonenumber-field/workflows/Test/badge.svg .. image:: https://img.shields.io/coveralls/stefanfoulis/django-phonenumber-field/develop.svg :target: https://coveralls.io/github/stefanfoulis/django-phonenumber-field?branch=main A Django library which interfaces with `python-phonenumbers`_ to validate, pretty print and convert phone numbers. ``python-phonenumbers`` is a port of Google's `libphonenumber`_ library, which powers Android's phone number handling. .. _`python-phonenumbers`: https://github.com/daviddrysdale/python-phonenumbers .. _`libphonenumber`: https://github.com/google/libphonenumber Documentation ============= https://django-phonenumber-field.readthedocs.io/ Running tests ============= tox needs to be installed. To run the whole test matrix with the locally available Python interpreters and generate a combined coverage report:: tox run a specific combination:: tox -e py310-djmain,py39-djmain
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 8.4.0 | Imported from PyPI (8.4.0) | Low | 4/21/2026 |
| 8.3.0 | ## What's Changed * Allow configuring `empty_value` and `max_length` for `SplitPhoneNumberField` by @ilkkao in https://github.com/stefanfoulis/django-phonenumber-field/pull/632 Mimics django `CharField` behavior more closely: - `empty_value` offers controls over the normalization (typically, the empty str `""` or `None`) - `max_length` allows using the form field with `forms_for_model` ## New Contributors * @ilkkao made their first contribution in https://github.com | Low | 10/6/2025 |
| 8.2.0 | ## What's Changed * Fix lost region when `PHONENUMBER_DEFAULT_FORMAT` is `NATIONAL` by @bblanchon in https://github.com/stefanfoulis/django-phonenumber-field/pull/636 * Bump actions/setup-python from 5 to 6 by @dependabot[bot] in https://github.com/stefanfoulis/django-phonenumber-field/pull/642 * Fix translations by @interDist in https://github.com/stefanfoulis/django-phonenumber-field/pull/641 * Add Hungarian locale by @karolyi in https://github.com/stefanfoulis/django-phonenumber-field/pul | Low | 10/2/2025 |
| 8.1.0 | ## What's Changed * Remove non-geo phone numbers from the SplitPhoneNumberWidget by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/614 The phone number prefix field allows to select a world region, and maps to its prefix (e.g. get `+33` for France). It was incorrectly offering regions reserved for very specific use and which cannot be mapped to a world region. Example prefixes include 800 (Universal International Freephone Service), 808 (Universal Inte | Low | 4/10/2025 |
| 8.0.0 | ## What's Changed ### Breaking changes * Remove `PhoneNumberInternationalFallbackWidget` by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/602 Use `phonenumber_field.widgets.RegionalPhoneNumberWidget` instead. * Move validation from widgets to the form fields by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/603 Previously, the widgets were validating the phone number, leaving no room for the [django regular | Low | 6/24/2024 |
| 7.3.0 | ## What's Changed * Add support for Django 5.0 by @adamchainz in https://github.com/stefanfoulis/django-phonenumber-field/pull/582 * Document phone number extension handling by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/583 * Make PhoneNumberPrefixSelect use the provided region by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/593 * Update Italian locale by @RuggeroFabbiano in https://github.com/stefanfoulis/django-pho | Low | 12/29/2023 |
| 7.2.0 | *This release should have been an 8.0 by the semver, as the DB converter for the model field can break working code.* ## What's Changed * **BREAKING**: Add a DB converter for the model field, fixing `values_list()` of `PhoneNumberField`s by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/559 * Use public attributes and methods from phonenumbers by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/535 * Remove zip_safe flag | Low | 10/5/2023 |
| 7.1.0 | ## What's Changed * Update Norwegian translations by @ddabble in https://github.com/stefanfoulis/django-phonenumber-field/pull/549 * Drop support for Django 4.0, add Django 4.2 by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/550 ### Miscellaneous * Update python and Django matrix by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/548 * Add common virtualenv locations to flake8 exclude and .gitignore by @blaedd in https | Low | 4/26/2023 |
| 7.0.2 | ## What's Changed * Updated Swedish translations by @tjwalch in https://github.com/stefanfoulis/django-phonenumber-field/pull/544 ## New Contributors * @tjwalch made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/544 **Full Changelog**: https://github.com/stefanfoulis/django-phonenumber-field/compare/7.0.1...7.0.2 | Low | 1/9/2023 |
| 7.0.1 | ## What's Changed * Allow multiple DRF is_valid calls to succeed by @phillipuniverse in https://github.com/stefanfoulis/django-phonenumber-field/pull/543 ## New Contributors * @phillipuniverse made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/543 **Full Changelog**: https://github.com/stefanfoulis/django-phonenumber-field/compare/7.0.0...7.0.1 | Low | 12/6/2022 |
| 7.0.0 | ## Possible backward incompatibilities - `RegionalPhoneNumberWidget` becomes the default widget for the `formfields.PhoneNumberField`. - The `formfields.PhoneNumberField` no longer sets the `input_type` attribute of its widget to `tel`. That behavior did not make sense for the existing `PhoneNumberPrefixWidget` and was dropped. - `PhoneNumberInternationalFallbackWidget` will be replaced by `RegionalPhoneNumberWidget` in the next major version. It is deprecated until the next major release. | Low | 9/7/2022 |
| 6.4.0 | ## What's Changed * Allow restricting PhoneNumberPrefixWidget country choices by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/525 * Handle empty input to PhoneNumberPrefixWidget by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/512 * Handle primitive types in serializerfields by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/523 * Implement region argument for serializerfields by @franc | Low | 8/28/2022 |
| 6.3.0 | ## What's Changed * Accept per-widget attrs for PhoneNumberPrefixWidget by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/502 * Drop Django 3.1 support by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/505 **Full Changelog**: https://github.com/stefanfoulis/django-phonenumber-field/compare/6.2.0...6.3.0 | Low | 6/17/2022 |
| 6.2.0 | ## What's Changed * `PhoneNumberPrefixWidget` improvement for regions sharing same country prefix by @amateja in https://github.com/stefanfoulis/django-phonenumber-field/pull/493 * Remove `maxlength` attribute for html5 compliance by @sterliakov in https://github.com/stefanfoulis/django-phonenumber-field/pull/490 * Better syntax highlighting by @bashu in https://github.com/stefanfoulis/django-phonenumber-field/pull/498 * Update Polish translation by @amateja in https://github.com/stefanfouli | Low | 6/14/2022 |
| 6.1.0 | ## What's Changed ### Features * Make `formfields.PhoneNumberField` honor `PHONENUMBER_DEFAULT_REGION` by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/476 * Use the default regionβs format in form errors by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/483 ### Translations * Update and translate uk_AR locale. by @trufanovoleh in https://github.com/stefanfoulis/django-phonenumber-field/pull/360 * Add persian(farsi) tra | Low | 2/15/2022 |
| 6.0.0 | ## What's Changed * Add support for Python 3.10 * Update Czech, Dutch and pt_BR translations **Backwards incompatible changes** * ``formfields.PhoneNumberField`` with a ``region`` now display national phone numbers in the national format instead of ``PHONENUMBER_DEFAULT_FORMAT``. International numbers are displayed in the ``PHONENUMBER_DEFAULT_FORMAT``. ## New Contributors * @maartenkling made their first contribution in https://github.com/stefanfoulis/django-phonenumber-fi | Low | 11/10/2021 |
