1๐
โ
I dont think you can do that really โฆ however you could probably specify the form input as only numeric (perhaps with forms.IntegerField
)
or you could write your own validator
from django.core.exceptions import ValidationError
def validate_numeric(value):
if not (9 <= len(re.sub("[^0-9]","",value)) <= 15):
raise ValidationError('%s is not a valid phone number' % value)
๐คJoran Beasley
Source:stackexchange.com