summaryrefslogtreecommitdiff
path: root/workshop_app
diff options
context:
space:
mode:
authorMahesh Gudi2017-06-23 13:02:22 +0530
committerGitHub2017-06-23 13:02:22 +0530
commit0c34e32adfcef38a7a16339ce6a4fa95ef9a28ba (patch)
treeec883649c5c7c6766978db143942417470977aa4 /workshop_app
parent8047cfb34d05521bcb97b8dd1dd07dfd16739e73 (diff)
parented5b29cec9254eef7b02c8aeed3ddca4390e24e3 (diff)
downloadworkshop_booking-0c34e32adfcef38a7a16339ce6a4fa95ef9a28ba.tar.gz
workshop_booking-0c34e32adfcef38a7a16339ce6a4fa95ef9a28ba.tar.bz2
workshop_booking-0c34e32adfcef38a7a16339ce6a4fa95ef9a28ba.zip
Merge pull request #9 from Akshen/testing
Fixes Regex Issue
Diffstat (limited to 'workshop_app')
-rw-r--r--workshop_app/forms.py4
-rw-r--r--workshop_app/models.py11
2 files changed, 8 insertions, 7 deletions
diff --git a/workshop_app/forms.py b/workshop_app/forms.py
index 90ca733..cce6dfc 100644
--- a/workshop_app/forms.py
+++ b/workshop_app/forms.py
@@ -51,9 +51,9 @@ class UserRegistrationForm(forms.Form):
(max_length=32, widget=forms.PasswordInput())
first_name = forms.CharField(max_length=32)
last_name = forms.CharField(max_length=32)
- phone_number = forms.RegexField(regex=r'^\+?1?\d{9,15}$',
+ phone_number = forms.RegexField(regex=r'^.{10}$',
error_message=("Phone number must be entered \
- in the format: '+999999999'.\
+ in the format: '9999999999'.\
Up to 10 digits allowed."))
institute = forms.CharField(max_length=128,
help_text='Please write full name of your Institute/Organization')
diff --git a/workshop_app/models.py b/workshop_app/models.py
index 35a1f38..5e7734c 100644
--- a/workshop_app/models.py
+++ b/workshop_app/models.py
@@ -11,7 +11,7 @@ position_choices = (
)
department_choices = (
- ("computer", "Computer Science"),
+ ("computer engineering", "Computer Science"),
("information technology", "Information Technology"),
("civil engineering", "Civil Engineering"),
("electrical engineering", "Electrical Engineering"),
@@ -24,6 +24,7 @@ department_choices = (
("others", "Others"),
)
+
def has_profile(user):
""" check if user has profile """
return True if hasattr(user, 'profile') else False
@@ -38,12 +39,12 @@ class Profile(models.Model):
institute = models.CharField(max_length=150)
department = models.CharField(max_length=150, choices=department_choices)
phone_number = models.CharField(
- max_length=15,
+ max_length=10,
validators=[RegexValidator(
- regex=r'^.{9}$', message=(
+ regex=r'^.{10}$', message=(
"Phone number must be entered \
- in the format: '+99999999'.\
- Up to 15 digits allowed.")
+ in the format: '9999999999'.\
+ Up to 10 digits allowed.")
)]
,null=False)
position = models.CharField(max_length=32, choices=position_choices,