summaryrefslogtreecommitdiff
path: root/workshop_app/models.py
diff options
context:
space:
mode:
authorAkshen2017-02-14 14:01:37 +0530
committerAkshen2017-05-19 15:30:31 +0530
commit8a2bd288c77ce3165518f7bf1eff75825b4db5b3 (patch)
treeb591cdd49ecb8571585b4ac5428d87ebc01ea9ee /workshop_app/models.py
parent379d04803c59b350b7061ab2557542449aafc0e8 (diff)
downloadworkshop_booking-8a2bd288c77ce3165518f7bf1eff75825b4db5b3.tar.gz
workshop_booking-8a2bd288c77ce3165518f7bf1eff75825b4db5b3.tar.bz2
workshop_booking-8a2bd288c77ce3165518f7bf1eff75825b4db5b3.zip
Basic Login Done
Diffstat (limited to 'workshop_app/models.py')
-rw-r--r--workshop_app/models.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/workshop_app/models.py b/workshop_app/models.py
index bd4b2ab..07db83a 100644
--- a/workshop_app/models.py
+++ b/workshop_app/models.py
@@ -1,5 +1,25 @@
-from __future__ import unicode_literals
-
+#from __future__ import unicode_literals
from django.db import models
+from django.contrib.auth.models import User
+
+position_choices = (
+ ("student", "Student"),
+ ("instructor", "Instructor")
+ )
+
+class Profile(models.Model):
+ """Profile for users"""
+
+ user = models.OneToOneField(User)
+ institute = models.CharField(max_length=150)
+ department = models.CharField(max_length=150)
+ 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)
+
+
+def has_profile(user):
+ """ check if user has profile """
+ return True if hasattr(user, 'profile') else False
-# Create your models here.