diff options
author | Akshen Doke | 2017-03-07 11:26:04 +0530 |
---|---|---|
committer | Akshen | 2017-05-19 15:30:31 +0530 |
commit | 2a0875890fd64e6b3b86a7e08378eea36bcf7ce4 (patch) | |
tree | 2c08e13142c7e165912e60662dfdc1d0e95f492b /workshop_app/models.py | |
parent | 057e1ded6560f03ed5a66885eef452bf3317b645 (diff) | |
download | workshop_booking-2a0875890fd64e6b3b86a7e08378eea36bcf7ce4.tar.gz workshop_booking-2a0875890fd64e6b3b86a7e08378eea36bcf7ce4.tar.bz2 workshop_booking-2a0875890fd64e6b3b86a7e08378eea36bcf7ce4.zip |
Phone Number added, email verification todo
Diffstat (limited to 'workshop_app/models.py')
-rw-r--r-- | workshop_app/models.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/workshop_app/models.py b/workshop_app/models.py index 9aceb57..8c146c0 100644 --- a/workshop_app/models.py +++ b/workshop_app/models.py @@ -1,6 +1,7 @@ #from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User +from django.core.validators import RegexValidator position_choices = ( @@ -20,10 +21,21 @@ class Profile(models.Model): user = models.OneToOneField(User) institute = models.CharField(max_length=150) department = models.CharField(max_length=150) + phone_number = models.CharField( + max_length=15, + validators=[RegexValidator( + regex=r'^\+?1?\d{9,15}$', message=( + "Phone number must be entered \ + in the format: '+999999999'.\ + Up to 15 digits allowed.") + )]) position = models.CharField(max_length=32, choices=position_choices) def __str__(self): - return u"{0} {1} | {2}".format(self.user.first_name, self.user.last_name, self.user.email) + return u"{0} {1} | {2} ".format(self.user.first_name, + self.user.last_name, + self.user.email + ) class Course(models.Model): |