quiz/models.py
author nishanth
Tue, 20 Apr 2010 23:12:15 +0530
changeset 22 fe197c0c9903
parent 16 ad51f38d0339
child 23 f57c30096b51
permissions -rw-r--r--
modified the questionbank model and changed in seed_db accordingly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
     1
from django.db import models
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
     2
from django.contrib.auth.models import User
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
     3
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
     4
from offline.event.models import Event
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
     5
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
     6
class Profile(models.Model):
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
     7
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
     8
    user = models.ForeignKey(User)
15
99af908a4174 added questions thro seed_db
nishanth
parents: 14
diff changeset
     9
    profession = models.CharField(max_length=20,help_text="(Ex: Faculty, Student etc.)")
12
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    10
    affiliated_to = models.CharField(max_length=100, verbose_name="College/Company")
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    11
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    12
class QuestionBank(models.Model):
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    13
    """ A model for holding the database of questions.
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    14
    """
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    15
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    16
    quiz_num = models.CharField(max_length=2)
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    17
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    18
    description = models.TextField()
22
fe197c0c9903 modified the questionbank model and changed in seed_db accordingly
nishanth
parents: 16
diff changeset
    19
    code = models.TextField()
fe197c0c9903 modified the questionbank model and changed in seed_db accordingly
nishanth
parents: 16
diff changeset
    20
    options = models.TextField()
12
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    21
    time_limit = models.PositiveSmallIntegerField()
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    22
    expected_ans = models.TextField()
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    23
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    24
class Answer(models.Model):
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    25
    """ A model for holding answers submitted by users.
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    26
    """
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    27
14
ea7d372bfbff implemented more constraints on the register for test page
nishanth
parents: 13
diff changeset
    28
    question = models.ForeignKey(QuestionBank)
12
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    29
    submitted_ans = models.TextField()
14
ea7d372bfbff implemented more constraints on the register for test page
nishanth
parents: 13
diff changeset
    30
    is_correct = models.BooleanField()
12
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    31
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    32
class Quiz(models.Model):
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    33
    """ A model to hold the proceeding of a quiz.
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    34
    """
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    35
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    36
    user = models.ForeignKey(User)
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    37
    event = models.ForeignKey(Event)
13
ad193c5014b2 added ip field to model and used it in start page
nishanth
parents: 12
diff changeset
    38
    user_ip = models.CharField(max_length=15)
16
ad51f38d0339 implemented the start quiz functionality
nishanth
parents: 15
diff changeset
    39
    key = models.CharField(max_length=10)
12
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    40
    
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    41
    quiz_num = models.CharField(max_length=2)
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    42
    que_remaining = models.CharField(max_length=100)
81cd0140a0f2 created the register user functionality.
nishanth
parents:
diff changeset
    43
    que_answered = models.ManyToManyField(Answer)
15
99af908a4174 added questions thro seed_db
nishanth
parents: 14
diff changeset
    44