A django model and form field for normalised phone numbers using python-phonenumbers

Overview

django-phonenumber-field

https://travis-ci.org/stefanfoulis/django-phonenumber-field.svg?branch=master

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.

Included are:

  • PhoneNumber, a pythonic wrapper around python-phonenumbers' PhoneNumber class
  • PhoneNumberField, a model field
  • PhoneNumberField, a form field
  • PhoneNumberField, a serializer field
  • PhoneNumberPrefixWidget, a form widget for selecting a region code and entering a national number. Requires the Babel package be installed.
  • PhoneNumberInternationalFallbackWidget, a form widget that uses national numbers unless an international number is entered. A PHONENUMBER_DEFAULT_REGION setting needs to be added to your Django settings in order to know which national number format to recognize. The setting is a string containing an ISO-3166-1 two-letter country code.

Installation

pip install django-phonenumber-field[phonenumbers]

As an alternative to the phonenumbers package, it is possible to install the phonenumberslite package which has a lower memory footprint.

pip install django-phonenumber-field[phonenumberslite]

Basic usage

First, add phonenumber_field to the list of the installed apps in your settings.py file:

INSTALLED_APPS = [
    ...
    'phonenumber_field',
    ...
]

Then, you can use it like any regular model field:

from phonenumber_field.modelfields import PhoneNumberField

class MyModel(models.Model):
    name = models.CharField(max_length=255)
    phone_number = PhoneNumberField()
    fax_number = PhoneNumberField(blank=True)

Internally, PhoneNumberField is based upon CharField and by default represents the number as a string of an international phonenumber in the database (e.g '+41524204242').

Representation can be set by PHONENUMBER_DB_FORMAT variable in django settings module. This variable must be one of 'E164', 'INTERNATIONAL', 'NATIONAL' or 'RFC3966'. Recommended is one of the globally meaningful formats 'E164', 'INTERNATIONAL' or 'RFC3966'. 'NATIONAL' format require to set up PHONENUMBER_DEFAULT_REGION variable.

The object returned is a PhoneNumber instance, not a string. If strings are used to initialize it, e.g. via MyModel(phone_number='+41524204242') or form handling, it has to be a phone number with country code.

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 py36-djmaster,py39-djmaster
Comments
  • Create a new 0.7 version?

    Create a new 0.7 version?

    The 0.6 version has some bugs (like'NoneType' object has no attribute 'as_e164') which are resolved in merges there after, but difficult to get the latest version from pip.

    opened by devangmundhra 15
  • Save should not raise `ValueError` on invalid phonenumber

    Save should not raise `ValueError` on invalid phonenumber

    Save() should only raise ValueErrors when the data to be stored is incompatible with the raw field data. A string that contains data that is not a valid phone number doesn't count as invalid, and should be checked in clean(), not in save().

    closes #334

    opened by karolyi 14
  • Widget initial by label, not value (country code US does not initialize as United States)

    Widget initial by label, not value (country code US does not initialize as United States)

    I am trying to set the initial value of the Prefix select, the issue is that when using initial='US' the select defaults to "American Samoa" because it is the first item in the list with the value of "+1", rather than "United States".

    Is there a way to set the initial value based on the label rather than the value because of the duplicate country codes?

    opened by nwaxiomatic 14
  • Serialization

    Serialization

    The modelfield is not JSON serializable out fo the box. Custom solutions have to be used to make it so or else it raises an error as below 👍 :

      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 179, in default
        raise TypeError(f'Object of type {o.__class__.__name__} '
    TypeError: Object of type PhoneNumber is not JSON serializable
    

    Suggest it is implemented out of the box for use with Django Rest Framework.

    opened by jerryshikanga 13
  • Default Country Code?

    Default Country Code?

    Is there a way append a default country code? If no Country code is typed? I am thinking along the lines of, mobile = PhoneNumberField(required=True, country='india') or mobile = PhoneNumberField(required=True, country='+91') My users are not smart enough to add their own country code, sometimes. It raises few errors. I currently tell them add the country code in a html placeholder.

    opened by CT83 12
  • Add a new widget for smart switching between national and international formats

    Add a new widget for smart switching between national and international formats

    Currently, if using PHONENUMBER_DEFAULT_FORMAT = 'NATIONAL' numbers that are entered in international format lose their country information on loading the form, meaning they cannot be validated. This widget checks if the number provided is in the expected region and renders it in national format if so, or international if there's a mismatch.

    opened by MatthewWilkes 11
  • Several improvements

    Several improvements

    I made several little tweaks to the field. There were a few subtle bugs introduced in recent commits, which should be fixed. I also gave the test suite some love. Two features were added; specificing PHONENUMBER_DEFAULT_FORMAT (instead of defaulting to E164), and hinting at the region when using parse_string.

    I've added a note on null=True being discouraged for usage with the PhoneNumberField. As with CharFields, in most cases one doesn't want two different "empty" statuses, '' and None.

    I suggest making PhoneNumberField stricter, only accepting valid phone numbers by default. But that's a backwards-incompatible change and should be discussed.

    opened by maiksprenger 11
  • Normal Nigerian number should be 10 digits long excluding country code

    Normal Nigerian number should be 10 digits long excluding country code

    I am currently faced with the issue of validating Nigerian numbers. Normally, a typical Nigerian number is +234 XXX XXX XXXX or 0XX XXX XXX XX and when I test the formatted number against this regex r'^(0|\+234)[0-9]{10}', I always get this assertion error

    AssertionError: Lists differ: [ErrorDetail(string=*Enter a valid phone number.', code='invalid')] != ['... phone number cannot be the same as your phone number.']
    

    My settings.py has PHONENUMBER_DEFAULT_REGION = 'NG', and I tested my regex against the return value of phonenumbers.format_number( phonenumbers.parse(str(value), settings.PHONENUMBER_DEFAULT_REGION), phonenumbers.PhoneNumberFormat.E164 )

    opened by Sirneij 10
  • Can not install `django-phonenumber-field` properly with `pipenv`

    Can not install `django-phonenumber-field` properly with `pipenv`

    Original issue: https://github.com/pypa/pipenv/issues/1322

    When installing django-phonenumber-field strange issue happens. When running direct pipenv install django-phonenumber-field everything works fine. But when another developer tries to install the requirements from Pipfile, for some reason package phonenumberslite is missing.

    I feel like this line in setup.py is the cause of this issue: https://github.com/stefanfoulis/django-phonenumber-field/blob/master/setup.py#L8

    Here are the Pipfile and Pipfile.lock:

    [[source]]
    
    url = "https://pypi.python.org/simple"
    verify_ssl = true
    name = "pypi"
    
    
    [packages]
    
    django-phonenumber-field = "*"
    
    
    [dev-packages]
    
    
    {
        "_meta": {
            "hash": {
                "sha256": "1d4c4482eaa30ae2c0c4f7a2391984c1572af4984fa202fd3b5bbfbe37f6f7ac"
            },
            "host-environment-markers": {
                "implementation_name": "cpython",
                "implementation_version": "3.6.4",
                "os_name": "posix",
                "platform_machine": "x86_64",
                "platform_python_implementation": "CPython",
                "platform_release": "15.6.0",
                "platform_system": "Darwin",
                "platform_version": "Darwin Kernel Version 15.6.0: Fri Feb 17 10:21:18 PST 2017; root:xnu-3248.60.11.4.1~1/RELEASE_X86_64",
                "python_full_version": "3.6.4",
                "python_version": "3.6",
                "sys_platform": "darwin"
            },
            "pipfile-spec": 6,
            "requires": {},
            "sources": [
                {
                    "name": "pypi",
                    "url": "https://pypi.python.org/simple",
                    "verify_ssl": true
                }
            ]
        },
        "default": {
            "babel": {
                "hashes": [
                    "sha256:ad209a68d7162c4cff4b29cdebe3dec4cef75492df501b0049a9433c96ce6f80",
                    "sha256:8ce4cb6fdd4393edd323227cba3a077bceb2a6ce5201c902c65e730046f41f14"
                ],
                "version": "==2.5.3"
            },
            "django": {
                "hashes": [
                    "sha256:52475f607c92035d4ac8fee284f56213065a4a6b25ed43f7e39df0e576e69e9f",
                    "sha256:d96b804be412a5125a594023ec524a2010a6ffa4d408e5482ab6ff3cb97ec12f"
                ],
                "version": "==2.0.1"
            },
            "django-phonenumber-field": {
                "hashes": [
                    "sha256:d96c274a6aa9afd4eb4fe922e475a45706d997b2bea22b87f3afc9fb0012db84"
                ],
                "version": "==2.0.0"
            },
            "pytz": {
                "hashes": [
                    "sha256:80af0f3008046b9975242012a985f04c5df1f01eed4ec1633d56cc47a75a6a48",
                    "sha256:feb2365914948b8620347784b6b6da356f31c9d03560259070b2f30cff3d469d",
                    "sha256:59707844a9825589878236ff2f4e0dc9958511b7ffaae94dc615da07d4a68d33",
                    "sha256:d0ef5ef55ed3d37854320d4926b04a4cb42a2e88f71da9ddfdacfde8e364f027",
                    "sha256:c41c62827ce9cafacd6f2f7018e4f83a6f1986e87bfd000b8cfbd4ab5da95f1a",
                    "sha256:8cc90340159b5d7ced6f2ba77694d946fc975b09f1a51d93f3ce3bb399396f94",
                    "sha256:dd2e4ca6ce3785c8dd342d1853dd9052b19290d5bf66060846e5dc6b8d6667f7",
                    "sha256:699d18a2a56f19ee5698ab1123bbcc1d269d061996aeb1eda6d89248d3542b82",
                    "sha256:fae4cffc040921b8a2d60c6cf0b5d662c1190fe54d718271db4eb17d44a185b7"
                ],
                "version": "==2017.3"
            }
        },
        "develop": {}
    }
    
    
    Describe your environment
    1. OS Type: macos
    2. Python version: 3.6.4
    3. Pipenv version: 9.0.1
    Expected result

    I expect that django-phonenumber-field and all its dependencies will be installed.

    Actual result

    phonenumberslite is not installed.

    Steps to replicate
    1. pipenv install django-phonenumber-field
    2. pipenv run pip freeze, you will see something like:
    Babel==2.5.3
    Django==2.0.1
    django-phonenumber-field==2.0.0
    phonenumberslite==8.8.9
    pytz==2017.3
    
    1. pipenv --rm (we simulate a situation when we have to use Pipfile for installing dependencies)
    2. pipenv install
    3. pipenv run pip freeze, you will see something like this:
    Babel==2.5.3
    Django==2.0.1
    django-phonenumber-field==2.0.0
    pytz==2017.3
    
    opened by sobolevn 10
  • Add by region lookup method for phonenumberfields

    Add by region lookup method for phonenumberfields

    Phone numbers can be found using associated region like 'FR', 'UK', 'US', etc.

    queryset.filter(phone_number_field__region='FR)
    queryset.get(phone_numer_field__region='UK')
    

    Using startswith pattern with region codes

    LIKE '+44%';
    
    opened by cmehay 9
  • If blank=True, it's impossible to save an empty phone number

    If blank=True, it's impossible to save an empty phone number

    If you define a field like this in your models.py:

        faxnumber = PhoneNumberField(u'Fax',max_length=40,blank=True)
    
    You'll have this backtrace:
    
    Environment:
    
    
    Request Method: POST
    Request URL: http://morphee.hq.eyepea.be:8001/admin/xivo_web/entity/3/
    
    Django Version: 1.3.1
    Python Version: 2.5.2
    Installed Applications:
    ['django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'django.contrib.admin',
     'xivo_web']
    Installed Middleware:
    ('django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware')
    
    
    Traceback:
    File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
      111.                         response = callback(request, *callback_args, **callback_kwargs)
    File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in wrapper
      307.                 return self.admin_site.admin_view(view)(*args, **kwargs)
    File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in _wrapped_view
      93.                     response = view_func(request, *args, **kwargs)
    File "/usr/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
      79.         response = view_func(request, *args, **kwargs)
    File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in inner
      197.             return view(request, *args, **kwargs)
    File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in _wrapper
      28.             return bound_func(*args, **kwargs)
    File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in _wrapped_view
      93.                     response = view_func(request, *args, **kwargs)
    File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in bound_func
      24.                 return func(self, *args2, **kwargs2)
    File "/usr/lib/python2.5/site-packages/django/db/transaction.py" in inner
      217.                 res = func(*args, **kwargs)
    File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in change_view
      982.                 self.save_model(request, new_object, form, change=True)
    File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in save_model
      665.         obj.save()
    File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in save
      460.         self.save_base(using=using, force_insert=force_insert, force_update=force_update)
    File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in save_base
      526.                         rows = manager.using(using).filter(pk=pk_val)._update(values)
    File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in _update
      491.         return query.get_compiler(self.db).execute_sql(None)
    File "/usr/lib/python2.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
      869.         cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
    File "/usr/lib/python2.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
      735.         cursor.execute(sql, params)
    File "/usr/lib/python2.5/site-packages/django/db/backends/util.py" in execute
      34.             return self.cursor.execute(sql, params)
    File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/base.py" in execute
      86.             return self.cursor.execute(query, args)
    File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in execute
      168.         if not self._defer_warnings: self._warning_check()
    File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in _warning_check
      82.                     warn(w[-1], self.Warning, 3)
    File "/usr/lib/python2.5/warnings.py" in warn
      62.                   globals)
    File "/usr/lib/python2.5/warnings.py" in warn_explicit
      102.         raise message
    
    Exception Type: Warning at /admin/xivo_web/entity/3/
    Exception Value: Column 'faxnumber' cannot be null
    
    opened by GMLudo 9
  • Converting existing `CharFields` to `PhoneNumberField` with intact lookup

    Converting existing `CharFields` to `PhoneNumberField` with intact lookup

    When converting from:

    class MyModel(Model):
         phone = CharField()
    

    to

    class MyModel(Model):
         phone = PhoneNumberField()
    

    The old data is not lost. However, a lookup like:

    my_result = MyModel.objects.filter(phone=PhoneNumber.from_string('+31629322282'))
    

    does not yield any result; after re-saving all entries by doing:

    for m in MyModel.objects.all():
        m.save()
    

    The lookup does work. My guess is that when migrating from a Charfield to a PhoneNumberField some format conversion is not done. It would make sense that an AlterField operation in the migrations would convert the old values to the new values via PhoneNumber.from_string().

    It is possible for the programmer to do this themselves through a custom migration of course.

    Should this functionality be automatic?

    opened by lmbak 1
  • Formatting being lost

    Formatting being lost

    I recently upgraded to django-phonenumber-field[phonenumbers]==7.0.0 and now all my phone numbers, previously formatted like (800) 123-4567, are being reformatted as +18001234567.

    Do you know why this is?

    Is there a new flag or formatting template I should set to maintain my preferred format?

    opened by chrisspen 5
  • Document E164 lack of support for phone extensions

    Document E164 lack of support for phone extensions

    While changing the default is likely to cause large breakage, we can at least advertise that limitation and allow people to pick the INTERNATIONAL format (E163) if they need to support extensions.

    Fixes #205

    opened by francoisfreitag 0
  • Problem to validate short business numbers

    Problem to validate short business numbers

    Hi,

    I just tried django-phonenumber-field in my project and it seems so good. but I have problem to enter short numbers specially 4 or 5 digit numbers that used to use for business call centers.

    Is there any settings that let me validate such numbers or it need a hack?

    opened by Ali-Javanmardi 4
Releases(7.0.1)
  • 7.0.1(Dec 6, 2022)

    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

    Source code(tar.gz)
    Source code(zip)
  • 7.0.0(Sep 7, 2022)

    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.

    Changes

    • Restore PhoneNumberPrefixWidget number input on form errors by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/520

      Fixes a bug where the form field prepare_value() transformed the PhoneNumber value to an str in the national format, but PhoneNumberPrefixWidget expects its value to be a PhoneNumber. formfields.PhoneNumberField now represents its value with a PhoneNumber object, giving widgets more control on how to display the value.

      That behavior prompted the change to PhoneNumberInternationalFallbackWidget becoming the default widget, to preserve the behavior established in https://github.com/stefanfoulis/django-phonenumber-field/commit/005769cf39323e5b23710783f45befb546672cd6. Switching to the widget allows users to opt-out from that behavior (e.g. by using a TextInput widget), whereas prepare_value() forced the conversion to the national string format.

    • Set PhoneNumberInternationalFallbackWidget input_type to tel by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/521

      Previously, the <input> from the PhoneNumberInternationalFallbackWidget was set to text.

    • Evolve PhoneNumberInternationalWidget to RegionalPhoneNumberWidget by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/529

      The newer widget gives more control over the display of phone numbers. The behavior of PhoneNumberInternaltionalWidget can be retained by setting PHONENUMBER_DEFAULT_FORMAT="INTERNATIONAL", which is why PhoneNumberInternaltionalWidget will be removed in the next major version.

    • Add Dutch translation by @thijskramer in https://github.com/stefanfoulis/django-phonenumber-field/pull/532

    • Add documentation and host it at readthedocs.org by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/531

    • Prefer SUPPORTED_REGIONS over _AVAILABLE_REGION_CODES by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/528

    New Contributors

    • @thijskramer made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/532

    Full Changelog: https://github.com/stefanfoulis/django-phonenumber-field/compare/6.4.0...7.0.0

    Source code(tar.gz)
    Source code(zip)
    django-phonenumber-field-7.0.0.tar.gz(39.79 KB)
    django_phonenumber_field-7.0.0-py3-none-any.whl(64.15 KB)
  • 6.4.0(Aug 28, 2022)

    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 @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/519
    • Fix CHANGELOG link to GitHub Releases by @adamchainz in https://github.com/stefanfoulis/django-phonenumber-field/pull/507
    • Add compatibility with Django 4.1 by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/516
    • Drop support for end-of-life Django 2.2 by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/515

    New Contributors

    • @adamchainz made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/507

    Full Changelog: https://github.com/stefanfoulis/django-phonenumber-field/compare/6.3.0...6.4.0

    Source code(tar.gz)
    Source code(zip)
  • 6.3.0(Jun 17, 2022)

    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

    Source code(tar.gz)
    Source code(zip)
  • 6.2.0(Jun 14, 2022)

    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/stefanfoulis/django-phonenumber-field/pull/500
    • Update Lithuanian translations by @KiraLT in https://github.com/stefanfoulis/django-phonenumber-field/pull/390
    • Update Portuguese translations by @AndreMorais98 in https://github.com/stefanfoulis/django-phonenumber-field/pull/504

    New Contributors

    • @bashu made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/498
    • @KiraLT made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/390
    • @sterliakov made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/490
    • @AndreMorais98 made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/504

    Full Changelog: https://github.com/stefanfoulis/django-phonenumber-field/compare/6.1.0...6.2.0

    Source code(tar.gz)
    Source code(zip)
  • 6.1.0(Feb 15, 2022)

    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) translation by @maktoobgar in https://github.com/stefanfoulis/django-phonenumber-field/pull/479
    • Update turkish translations by @realsuayip in https://github.com/stefanfoulis/django-phonenumber-field/pull/487

    Versioning

    • Add support for Django 4.0 by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/478
    • Drop support for Python 3.6 by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/482

    Miscellaneous

    • Remove unnecessary STR cast from PhoneNumber.__repr__ by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/485
    • Prefer f-string to format strings by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/484
    • Cleanup import in tests by @francoisfreitag in https://github.com/stefanfoulis/django-phonenumber-field/pull/475

    New Contributors

    • @trufanovoleh made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/360
    • @maktoobgar made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/479

    Full Changelog: https://github.com/stefanfoulis/django-phonenumber-field/compare/6.0.0...6.1.0

    Source code(tar.gz)
    Source code(zip)
  • 6.0.0(Nov 10, 2021)

    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-field/pull/449
    • @melanger made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/454
    • @willunicamp made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/456
    • @fraimondo made their first contribution in https://github.com/stefanfoulis/django-phonenumber-field/pull/469

    Full Changelog: https://github.com/stefanfoulis/django-phonenumber-field/compare/5.2.0...6.0.0

    Source code(tar.gz)
    Source code(zip)
Owner
Stefan Foulis
/me ❤️ [Python, Django, Docker]
Stefan Foulis
MAC address Model Field & Form Field for Django apps

django-macaddress MAC Address model and form fields for Django We use netaddr to parse and validate the MAC address. The tests aren't complete yet. Pa

null 49 Sep 4, 2022
Tweak the form field rendering in templates, not in python-level form definitions. CSS classes and HTML attributes can be altered.

django-widget-tweaks Tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes is su

Jazzband 1.8k Jan 2, 2023
Resolve form field arguments dynamically when a form is instantiated

django-forms-dynamic Resolve form field arguments dynamically when a form is instantiated, not when it's declared. Tested against Django 2.2, 3.2 and

DabApps 108 Jan 3, 2023
Twitter Bootstrap for Django Form - A simple Django template tag to work with Bootstrap

Twitter Bootstrap for Django Form - A simple Django template tag to work with Bootstrap

tzangms 557 Oct 19, 2022
A reusable Django model field for storing ad-hoc JSON data

jsonfield jsonfield is a reusable model field that allows you to store validated JSON, automatically handling serialization to and from the database.

Ryan P Kilby 1.1k Jan 3, 2023
Basic Form Web Development using Python, Django and CSS

thebookrain Basic Form Web Development using Python, Django and CSS This is a basic project that contains two forms - borrow and donate. The form data

Ananya Dhulipala 1 Nov 27, 2021
Custom Django field for using enumerations of named constants

django-enumfield Provides an enumeration Django model field (using IntegerField) with reusable enums and transition validation. Installation Currently

5 Monkeys 195 Dec 20, 2022
Location field and widget for Django. It supports Google Maps, OpenStreetMap and Mapbox

django-location-field Let users pick locations using a map widget and store its latitude and longitude. Stable version: django-location-field==2.1.0 D

Caio Ariede 481 Dec 29, 2022
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

Chris Beaven 1.2k Jan 7, 2023
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

Chris Beaven 1.2k Dec 31, 2022
A drop-in replacement for django's ImageField that provides a flexible, intuitive and easily-extensible interface for quickly creating new images from the one assigned to the field.

django-versatileimagefield A drop-in replacement for django's ImageField that provides a flexible, intuitive and easily-extensible interface for creat

Jonathan Ellenberger 490 Dec 13, 2022
A pickled object field for Django

django-picklefield About django-picklefield provides an implementation of a pickled object field. Such fields can contain any picklable objects. The i

Gintautas Miliauskas 167 Oct 18, 2022
A pickled object field for Django

django-picklefield About django-picklefield provides an implementation of a pickled object field. Such fields can contain any picklable objects. The i

Gintautas Miliauskas 167 Oct 18, 2022
Twitter Bootstrap for Django Form

Django bootstrap form Twitter Bootstrap for Django Form. A simple Django template tag to work with Bootstrap Installation Install django-bootstrap-for

tzangms 557 Oct 19, 2022
This is a sample Django Form.

Sample FORM Installation guide Clone repository git clone https://github.com/Ritabratadas343/SampleForm.git cd to repository. Create a virtualenv by f

Ritabrata Das 1 Nov 5, 2021
This website serves as an online database (hosted via SQLLite) for fictional businesses in the area to store contact information (name, email, phone number, etc.) for fictional customers.

Django-Online-Business-Database-Project this project is still in progress Overview of Website This website serves as an online database (hosted via SQ

null 1 Oct 30, 2021
Django URL Shortener is a Django app to to include URL Shortening feature in your Django Project

Django URL Shortener Django URL Shortener is a Django app to to include URL Shortening feature in your Django Project Install this package to your Dja

Rishav Sinha 4 Nov 18, 2021
django-reversion is an extension to the Django web framework that provides version control for model instances.

django-reversion django-reversion is an extension to the Django web framework that provides version control for model instances. Requirements Python 3

Dave Hall 2.8k Jan 2, 2023
Full control of form rendering in the templates.

django-floppyforms Full control of form rendering in the templates. Authors: Gregor Müllegger and many many contributors Original creator: Bruno Renié

Jazzband 811 Dec 1, 2022