12 lines
313 B
Python
12 lines
313 B
Python
import re
|
|
|
|
from django.core.validators import RegexValidator
|
|
|
|
validate_phone = RegexValidator('^\+\d+$')
|
|
validate_fr_be_phone = RegexValidator('^\+(?:33[67]\d{8}|324\d{8})$')
|
|
|
|
|
|
def phone_normalize(phone_number):
|
|
'''Remove usual separators from phone number.'''
|
|
return re.sub('[\.\-\s]', '', phone_number)
|