diff options
author | Prabhu Ramachandran | 2011-11-25 18:48:13 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2011-11-25 18:48:13 +0530 |
commit | fdc531b561565345847812f409ee44af0a784e82 (patch) | |
tree | 447b297d28dccb700dcd244404e6cd748191890d /exam/models.py | |
parent | b4023e17d6f97e51ffde740c17d19630b5a9c2d1 (diff) | |
download | online_test-fdc531b561565345847812f409ee44af0a784e82.tar.gz online_test-fdc531b561565345847812f409ee44af0a784e82.tar.bz2 online_test-fdc531b561565345847812f409ee44af0a784e82.zip |
ENH: Adding support for Multiple Choice Questions
Adds simple support for multiple choice questions that are also
auto-checked. Many fixes to the templates and useful feature additions.
This changes the database.
Diffstat (limited to 'exam/models.py')
-rw-r--r-- | exam/models.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/exam/models.py b/exam/models.py index ef4312f..717e02e 100644 --- a/exam/models.py +++ b/exam/models.py @@ -12,9 +12,10 @@ class Profile(models.Model): position = models.CharField(max_length=64) -LANGUAGE_CHOICES = ( +QUESTION_TYPE_CHOICES = ( ("python", "Python"), ("bash", "Bash"), + ("mcq", "MultipleChoice"), ) ################################################################################ @@ -28,14 +29,16 @@ class Question(models.Model): description = models.TextField() # Number of points for the question. - points = models.IntegerField(default=1) + points = models.FloatField(default=1.0) # Test cases for the question in the form of code that is run. - # This is simple Python code. - test = models.TextField() + test = models.TextField(blank=True) - # The language being tested. - language = models.CharField(max_length=10, choices=LANGUAGE_CHOICES) + # Any multiple choice options. Place one option per line. + options = models.TextField(blank=True) + + # The type of question. + type = models.CharField(max_length=24, choices=QUESTION_TYPE_CHOICES) # Is this question active or not. If it is inactive it will not be used # when creating a QuestionPaper. |