quiz/models.py
changeset 12 81cd0140a0f2
child 13 ad193c5014b2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/quiz/models.py	Tue Apr 20 15:31:21 2010 +0530
@@ -0,0 +1,40 @@
+from django.db import models
+from django.contrib.auth.models import User
+
+from offline.event.models import Event
+
+class Profile(models.Model):
+
+    user = models.ForeignKey(User)
+    profession = models.CharField(max_length=20,help_text="(Ex: Faculty,Student etc.)")
+    affiliated_to = models.CharField(max_length=100, verbose_name="College/Company")
+
+class QuestionBank(models.Model):
+    """ A model for holding the database of questions.
+    """
+
+    quiz_num = models.CharField(max_length=2)
+
+    description = models.TextField()
+    type = models.CharField(max_length=1)
+    time_limit = models.PositiveSmallIntegerField()
+    expected_ans = models.TextField()
+
+class Answer(models.Model):
+    """ A model for holding answers submitted by users.
+    """
+
+    question = models.ForeignKey(Question)
+    submitted_ans = models.TextField()
+    is_correct = models.BoolenField()
+
+class Quiz(models.Model):
+    """ A model to hold the proceeding of a quiz.
+    """
+
+    user = models.ForeignKey(User)
+    event = models.ForeignKey(Event)
+    
+    quiz_num = models.CharField(max_length=2)
+    que_remaining = models.CharField(max_length=100)
+    que_answered = models.ManyToManyField(Answer)