Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

PhoneNumberField django forms

# form PhoneNumberField django

from phonenumber_field.formfields import PhoneNumberField
class ClientForm(forms.Form):
    phone = PhoneNumberField()
Comment

PREVIOUS NEXT
Code Example
Python :: is python good for web development 
Python :: bold some letters of string in python 
Python :: python draw rectangle on image 
Python :: python offline translate pypi 
Python :: asyncio run 
Python :: python make string one line 
Python :: how to get value from txtbox in flask 
Python :: how to make exe from.py file 
Python :: numpy moving average 
Python :: How to create role discord.py 
Python :: how to display values on top of bar in barplot seaborn 
Python :: ocaml add element to end of list 
Python :: how to make convert numpy array to string in python 
Python :: pandas nan values in column 
Python :: pandas merge df 
Python :: merge multiple excel workssheets into a single dataframe 
Python :: python message from teams 
Python :: xticks and yticks matplotlib 
Python :: check is string is nan python 
Python :: multiprocessing print does not work 
Python :: how to make gtts text to speech converter 
Python :: if else in list comprehension 
Python :: python string contains 
Python :: django password field 
Python :: selenium element_to_be_clickable PYTHON 
Python :: import system in python 
Python :: python regex search file 
Python :: python list add element to front 
Python :: python get current date and time 
Python :: sqlalchemy_database_uri 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =