From 2ec613cf0d73553287a74a1536d39cc962b1ce0c Mon Sep 17 00:00:00 2001 From: Primal Pappachan Date: Tue, 21 Feb 2012 17:13:58 +0530 Subject: added Profile to models and various choice dictionaries for examination, option and category --- allotter/models.py | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'allotter/models.py') diff --git a/allotter/models.py b/allotter/models.py index ddb1b2d..ee5860f 100644 --- a/allotter/models.py +++ b/allotter/models.py @@ -1,11 +1,28 @@ from django.db import models - +from django.contrib.auth.models import User from datetime import datetime +EXAMINATION_SUBJECTS = ( + ("physics", "Physics"), + ("mathematics", "Mathematics"), + ("chemistry", "Chemistry"), + ) + +CATEGORIES = ( + ("GEN", "GENERAL"), + ("OBC", "OTHER BACKWARD CASTE"), + ) + +OPTIONS = ( + ("M.Sc Chem", "M.Sc Chemisty"), + ("M.Sc Phy", "M.Sc Physics"), + ("M.Sc Math","M.Sc Mathematics")) + class Option(models.Model): opt_name = models.CharField(max_length=100, verbose_name=u"Option name", - help_text=u"Name of Option/Stream") + help_text=u"Name of Option/Stream", + choices = OPTIONS) class Meta: verbose_name_plural = "Options" @@ -15,7 +32,8 @@ class Exam(models.Model): help_text=u"Unique code for the examination") exam_name = models.CharField(max_length=100, verbose_name=u"Examination name", - help_text=u"Subject name of the examination") + help_text=u"Subject name of the examination", + choices=EXAMINATION_SUBJECTS) option_available = models.ForeignKey("Option", default=1) @@ -23,12 +41,18 @@ class Exam(models.Model): return self.exam_name -class Student(models.Model): - name = models.CharField(max_length=1024, verbose_name=u"Name", +class Profile(models.Model): + user = models.OneToOneField(User) + name = models.CharField(max_length=1024, verbose_name=u"Full Name", help_text=u"Name given in the application") + roll_number = models.CharField(max_length=20, + verbose_name=u"Examination Roll number", + help_text=u"Roll number as per the Examination Hall ticket") dob = models.DateTimeField(verbose_name=u"Date of Birth", help_text=u"Date of birth as given in the application") - created = models.DateTimeField(auto_now_add=True) + category = models.CharField(max_length=30, choices=CATEGORIES) + email = models.CharField(max_length=50, verbose_name=u"Email id", + help_text=u"This will be for correspondence purposes") exam_taken = models.ForeignKey("Exam", default=1) -- cgit