Answers for "django what should I make a telephone number field type"

2

Django Phone Number Field

from django.core.validators import RegexValidator

class PhoneModel(models.Model):
    ...
    phone_regex = RegexValidator(regex=r'^+?1?d{9,15}$', message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.")
    phone_number = models.CharField(validators=[phone_regex], max_length=17, blank=True) # validators should be a list
Posted by: Guest on July-06-2021
0

django telephone field

# Custom field with international support and Android compatibility
https://github.com/stefanfoulis/django-phonenumber-field
Posted by: Guest on July-14-2021

Code answers related to "django what should I make a telephone number field type"

Browse Popular Code Answers by Language