regex - Only accept 11 digits in a IntegerField (not less than 11, and not more than 11) -


i have integerfield, want input accept value of 11 digits/numbers.

i have tried make regex validator on field, problem when try make model form field. validation-error if value 10 digits or less, if try value 12 digits , upwards, don't validation error.

here model field:

number =  models.integerfield(max_length=11, validators=[regexvalidator(r'\d{11,11}','number must 11 digits','invalid number')]) 

how can make validation error if value more 11 digits?

not sure django syntax, have use anchors:

r'^\d{11}$' 

Comments

Popular posts from this blog

css - I want to align grid in center -

python - SWIG function not printing output -

Contact Form PHP Email Script -