summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-12-19 22:56:28 +0530
committerGitHub2016-12-19 22:56:28 +0530
commit1400eeb1d5af1cd1d69e015a19a319ab35d357c4 (patch)
tree1fcd565a5bf35eefadc5e5f55cf2f113e3796b66 /yaksh/models.py
parentf416da9901ebca437c100bb80511eb87544f709d (diff)
parentd81919b6c8418da9bed0a78f5a7d5344f0ccbc16 (diff)
downloadonline_test-1400eeb1d5af1cd1d69e015a19a319ab35d357c4.tar.gz
online_test-1400eeb1d5af1cd1d69e015a19a319ab35d357c4.tar.bz2
online_test-1400eeb1d5af1cd1d69e015a19a319ab35d357c4.zip
Merge pull request #162 from prathamesh920/question-form-interface
Question form interface
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index dc12707..7fae305 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -53,6 +53,7 @@ test_case_types = (
("standardtestcase", "Standard Testcase"),
("stdiobasedtestcase", "StdIO Based Testcase"),
("mcqtestcase", "MCQ Testcase"),
+ ("hooktestcase", "Hook Testcase"),
)
attempts = [(i, i) for i in range(1, 6)]
@@ -1129,10 +1130,11 @@ class AssignmentUpload(models.Model):
################################################################################
class TestCase(models.Model):
question = models.ForeignKey(Question, blank=True, null = True)
+ type = models.CharField(max_length=24, choices=test_case_types, null=True)
class StandardTestCase(TestCase):
- test_case = models.TextField(blank=True)
- weight = models.FloatField(default=0.0)
+ test_case = models.TextField()
+ weight = models.FloatField(default=1.0)
def get_field_value(self):
return {"test_case": self.test_case,
@@ -1145,9 +1147,9 @@ class StandardTestCase(TestCase):
class StdioBasedTestCase(TestCase):
- expected_input = models.TextField(blank=True)
- expected_output = models.TextField()
- weight = models.IntegerField(default=0.0)
+ expected_input = models.CharField(max_length=100, blank=True)
+ expected_output = models.CharField(max_length=100)
+ weight = models.IntegerField(default=1.0)
def get_field_value(self):
return {"expected_output": self.expected_output,
@@ -1161,7 +1163,7 @@ class StdioBasedTestCase(TestCase):
class McqTestCase(TestCase):
- options = models.TextField()
+ options = models.CharField(max_length=100)
correct = models.BooleanField(default=False)
def get_field_value(self):
@@ -1171,3 +1173,8 @@ class McqTestCase(TestCase):
return u'Question: {0} | Correct: {1}'.format(self.question,
self.correct
)
+
+
+class HookTestCase(TestCase):
+ code = models.TextField()
+ weight = models.FloatField(default=1.0)