author | nishanth |
Wed, 21 Apr 2010 12:11:19 +0530 | |
changeset 29 | ea1c0110e989 |
parent 28 | 456b7b9e3d13 |
child 39 | 0fa055b8ea98 |
permissions | -rw-r--r-- |
12 | 1 |
from django.db import models |
2 |
from django.contrib.auth.models import User |
|
3 |
||
4 |
from offline.event.models import Event |
|
5 |
||
6 |
class Profile(models.Model): |
|
28
456b7b9e3d13
created a question bank xml file and created a seed_que command for adding questions to db from xml
nishanth
parents:
23
diff
changeset
|
7 |
""" A profile for quiz takers. |
456b7b9e3d13
created a question bank xml file and created a seed_que command for adding questions to db from xml
nishanth
parents:
23
diff
changeset
|
8 |
""" |
12 | 9 |
|
10 |
user = models.ForeignKey(User) |
|
15 | 11 |
profession = models.CharField(max_length=20,help_text="(Ex: Faculty, Student etc.)") |
12 | 12 |
affiliated_to = models.CharField(max_length=100, verbose_name="College/Company") |
13 |
||
14 |
class QuestionBank(models.Model): |
|
15 |
""" A model for holding the database of questions. |
|
16 |
""" |
|
17 |
||
18 |
quiz_num = models.CharField(max_length=2) |
|
19 |
||
20 |
description = models.TextField() |
|
22
fe197c0c9903
modified the questionbank model and changed in seed_db accordingly
nishanth
parents:
16
diff
changeset
|
21 |
code = models.TextField() |
fe197c0c9903
modified the questionbank model and changed in seed_db accordingly
nishanth
parents:
16
diff
changeset
|
22 |
options = models.TextField() |
12 | 23 |
time_limit = models.PositiveSmallIntegerField() |
24 |
expected_ans = models.TextField() |
|
25 |
||
26 |
class Answer(models.Model): |
|
27 |
""" A model for holding answers submitted by users. |
|
28 |
""" |
|
29 |
||
14
ea7d372bfbff
implemented more constraints on the register for test page
nishanth
parents:
13
diff
changeset
|
30 |
question = models.ForeignKey(QuestionBank) |
12 | 31 |
submitted_ans = models.TextField() |
14
ea7d372bfbff
implemented more constraints on the register for test page
nishanth
parents:
13
diff
changeset
|
32 |
is_correct = models.BooleanField() |
12 | 33 |
|
34 |
class Quiz(models.Model): |
|
35 |
""" A model to hold the proceeding of a quiz. |
|
36 |
""" |
|
37 |
||
38 |
user = models.ForeignKey(User) |
|
23 | 39 |
event = models.ForeignKey(Event, related_name="%(class)s") |
13 | 40 |
user_ip = models.CharField(max_length=15) |
16 | 41 |
key = models.CharField(max_length=10) |
12 | 42 |
|
43 |
quiz_num = models.CharField(max_length=2) |
|
44 |
que_remaining = models.CharField(max_length=100) |
|
45 |
que_answered = models.ManyToManyField(Answer) |
|
15 | 46 |