From fdc531b561565345847812f409ee44af0a784e82 Mon Sep 17 00:00:00 2001 From: Prabhu Ramachandran Date: Fri, 25 Nov 2011 18:48:13 +0530 Subject: 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. --- exam/models.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'exam/models.py') 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. -- cgit