From 5fe785962fd3a93acfbcb7d40d1fd38021c59436 Mon Sep 17 00:00:00 2001 From: Max Yakovenko Date: Tue, 31 Jul 2018 11:33:01 +0300 Subject: [PATCH] fix phone regex in contact_us model --- contact_us/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contact_us/models.py b/contact_us/models.py index f6a8cb2..7676da1 100644 --- a/contact_us/models.py +++ b/contact_us/models.py @@ -44,9 +44,9 @@ class Request(AbstractStatusModel): email = models.EmailField(_('Email')) subject = models.CharField(_('Subject'), max_length=500) message = models.TextField(blank=True, null=True) - phone_regex = RegexValidator(regex=r'^\((+7)|8)?\d{10}$', + phone_regex = RegexValidator(regex=r'^((\+7)|8)?\d{10}$', message="Phone number must be entered in the format: '+99999999999'. Up to 12 digits allowed.") - phone = models.CharField(validators=[phone_regex], max_length=12, blank=True, null=True) + phone = models.CharField(validators=(phone_regex,), max_length=12, blank=True, null=True) status = models.SmallIntegerField(_('Status'), default=REQUEST_DEFAULT_STATUS, choices=REQUEST_STATUS_CHOICES) @property