python - django-phonenumber-field: get phone number field validation pattern -
i using django-phonenumber-field
in model. parsley.js validate model form on client side. however, cannot find regular expression used validate phonenumberfield
field on server side.
i use exact same expression if possible.
here model , form:
from phonenumber_field.modelfields import phonenumberfield @python_2_unicode_compatible class cvapplication(application): mobile_phone_number = phonenumberfield() [...] @parsleyfy class cvapplicationform(forms.modelform): class meta: model = cvapplication fields = ( 'mobile_phone_number', [...] ) def __init__(self, *args, **kwargs): super(cvapplicationform, self).__init__(*args, **kwargs) self.fields['mobile_phone_number'].widget.attrs.update( {'data-parsley-pattern': '??????????'} ) [...]
thank help!
django-phonenumber-field relies on python-phoneumbers validate phone number.
you may able pick need out of here: https://github.com/daviddrysdale/python-phonenumbers/blob/dev/python/phonenumbers/phonenumbermatcher.py
Comments
Post a Comment