This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from http://stackoverflow.com/a/19131360/456878 | |
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], blank=True) |
No comments:
Post a Comment