diff options
author | Primal Pappachan | 2012-03-13 16:13:22 +0530 |
---|---|---|
committer | Primal Pappachan | 2012-03-13 16:13:22 +0530 |
commit | 0dbebcc524a4c35c0aa876c8fb8e75deeff6819c (patch) | |
tree | beafd81181bd95147bb2feb2c1c8ebcf6c63f7cd | |
parent | a8a644acdd7775da36cd109701a6a7235b851dd2 (diff) | |
download | aloha-0dbebcc524a4c35c0aa876c8fb8e75deeff6819c.tar.gz aloha-0dbebcc524a4c35c0aa876c8fb8e75deeff6819c.tar.bz2 aloha-0dbebcc524a4c35c0aa876c8fb8e75deeff6819c.zip |
Modified the models to accomodate verification of details and managing cases of two examinations for an applicant
-rw-r--r-- | allotter/models.py | 143 |
1 files changed, 72 insertions, 71 deletions
diff --git a/allotter/models.py b/allotter/models.py index 97c732d..e1f9243 100644 --- a/allotter/models.py +++ b/allotter/models.py @@ -1,64 +1,69 @@ 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", "GEN"), - ("OBC", "OBC(Non-Creamy Layer)"), - ("SC", "SC"), - ("ST", "ST"), - ) - -AVAILABLE_OPTIONS = ( - ("MScChem", "M.Sc Chemisty"), - ("MScPhy", "M.Sc Physics"), - ("MScMath","M.Sc Mathematics"), - ("MscHist", "M.Sc History"), -) - -GENDER_CHOICES = ( - ("M", "Male"), - ("F", "Female"),) - -APPLICATION_STATUS = ( - ("I", "Incomplete"), - ("Submitted", "Submitted")) - -BIRTH_YEAR_CHOICES = ('1989', '1990', '1991') - - -DEFAULT_EXAM_ID = 1 +##EXAMINATION_SUBJECTS = ( +## ("Physics", "Physics"), +## ("Mathematics", "Mathematics"), +## ("Chemistry", "Chemistry"), +## ) + +##CATEGORIES = ( +## ("GEN", "GEN"), +## ("OBC", "OBC(Non-Creamy Layer)"), +## ("SC", "SC"), +## ("ST", "ST"), +## ) + +##AVAILABLE_OPTIONS = ( +## ("MScChem", "M.Sc Chemisty"), +## ("M.Sc-Physics-IIT-Bombay", "M.Sc Physics IIT Bombay"), +## ("MScMath","M.Sc Mathematics"), +## ("MscHist", "M.Sc History"), +## ("MSc-PhD Dual-Degree-IIT-Bombay", "MSc-PhD Dual Degree IIT Bombay"), +## ("M.Sc Physics-IIT-Madras", "M.Sc Physics IIT Madras"), +## ("M.Sc-Physics-IIT-Guwahati", "M.Sc Physics IIT Guwahati"), +## ("M.Sc-Physics-IIT-KGP", "M.Sc Physics IIT KGP"), +## ("M.Sc-Physics-IIT-Roorkee", "M.Sc Physics IIT Roorkee"), +##) + +##GENDER_CHOICES = ( +## ("M", "Male"), +## ("F", "Female"),) + +##APPLICATION_STATUS = ( +## ("I", "Incomplete"), +## ("Submitted", "Submitted")) + +##BIRTH_YEAR_CHOICES = ('1989', '1990', '1991') class Exam(models.Model): - + """ + Table for Examination Codes and Subject names. + """ + ##PH for Physics, CY for Chemistry exam_code = models.CharField(max_length=100, - verbose_name=u"Examination code", - help_text=u"Unique code for the examination") + verbose_name=u"Test Paper code", + help_text=u"Unique code for the Test") exam_name = models.CharField(max_length=100, - verbose_name=u"Examination name", - help_text=u"Subject name of the examination", - choices=EXAMINATION_SUBJECTS) + verbose_name=u"Test Paper", + help_text=u"Subject name of the Test") def __unicode__(self): return self.exam_name class Option(models.Model): + """ + Options Table, Foreign Keyed with Examination. + """ opt_name = models.CharField(max_length=100, - verbose_name=u"Option name", - help_text=u"Name of Option/Stream", - choices = AVAILABLE_OPTIONS) - - seats = models.IntegerField(verbose_name=u"Seats available") + verbose_name=u"Programme name", + help_text=u"Programme Title") + + opt_code = models.IntegerField(max_length=3, + verbose_name=u"Programme Code") exam = models.ManyToManyField(Exam) @@ -73,46 +78,42 @@ class Profile(models.Model): user = models.OneToOneField(User) - application_number = models.IntegerField(max_length=20, - verbose_name=u"Examination Application number", - help_text=u"Application number as per the Examination Hall ticket") - + #Used for verification purposes dob = models.DateField(verbose_name=u"Date of Birth", help_text=u"Date of birth as given in the application") - - category = models.CharField(max_length=30, choices=CATEGORIES) - - exam_code = models.CharField(max_length=30, choices=EXAMINATION_SUBJECTS) - - rank = models.IntegerField(max_length=6) - - gender = models.CharField(max_length=10, choices=GENDER_CHOICES) - pd = models.BooleanField(default=False) - def __unicode__(self): - return unicode(self.application_number) + u = self.user + return u'User Profile {0} {1}'.format(u.first_name, u.last_name) class Application(models.Model): """An application for the student - one per student """ user = models.ForeignKey(User) - + profile = models.ForeignKey(Profile) - #To be modified to include multiple subjects for a student - exam_taken = models.ForeignKey(Exam) - - #All options chosen - options = models.ManyToManyField(Option) + ##To be filled by applicant + options_selected = models.CharField(max_length=5000,help_text="CSV formatted list of options") + + ##Prefilled fields + np = models.IntegerField(max_length=2, help_text="Number of Test Papers") + + ##Mandatory First Subject + first_paper = models.ForeignKey(Exam, related_name="first_paper") - status = models.CharField(max_length=24, choices=APPLICATION_STATUS) + ##Second subject can be left blank or null + second_paper = models.ForeignKey(Exam, related_name="second_paper", blank=True, null=True) - editable = models.BooleanField(default=True) + nat = models.CharField(max_length=10, verbose_name="Nationality") + + gender = models.CharField(max_length=2, verbose_name="Gender") + + cent = models.IntegerField(max_length=10, verbose_name="Center Code") + + cgy = models.CharField(max_length=10, verbose_name="Category") - def is_application_editable(self): - if self.status == "I": return True - else: return False + pd = models.BooleanField(verbose_name="Physical Disability", default=False, blank=True) def __unicode__(self): u = self.user |