Skip to main content

An international phone number field for django models.

Project description

A international phone number field for django that uses http://pypi.python.org/pypi/phonenumbers for validation .

Installation

pip install django-phonenumber-field

Basic usage

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(null=True, blank=True)

PhoneNumberField will always represent the number as a string of an international phonenumber in the database. E.g +41524204242.

The object returned is not just a plain String. It is a PhoneNumber object. Currently it is necessary to always use the international format when entering data.

Future versions of django-phonenumber-field may provide custom special widgets that support more custom formatting.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-phonenumber-field-0.2a3.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file django-phonenumber-field-0.2a3.tar.gz.

File metadata

File hashes

Hashes for django-phonenumber-field-0.2a3.tar.gz
Algorithm Hash digest
SHA256 29b53b806820062ecdd0d8122034fa89ee5543aba340f6a525f0844dee6d5e76
MD5 22e699f4bc6739cb809b6c9893f8a933
BLAKE2b-256 7433e5be5d69a6edb08ce77e31335856684cc86818d2591cdea9caaa41027c91

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page