summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-12-27 23:55:14 +0530
committerGitHub2016-12-27 23:55:14 +0530
commit011ca73b4c1042ceb208974e57c11474ecea65f2 (patch)
tree184452e83e9f35dbb356c0b4b411f38e5bea6ffd /yaksh
parent48df2c1b30fa4bfc256399bbaadcbdefa555623d (diff)
parentb582c624a7c49e3312e07196df87f26180a520c2 (diff)
downloadonline_test-011ca73b4c1042ceb208974e57c11474ecea65f2.tar.gz
online_test-011ca73b4c1042ceb208974e57c11474ecea65f2.tar.bz2
online_test-011ca73b4c1042ceb208974e57c11474ecea65f2.zip
Merge pull request #168 from maheshgudi/get_test_cases_fix
Fixed get_test_cases method
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/models.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 35e14e9..2bf4a85 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -317,17 +317,14 @@ class Question(models.Model):
def get_test_cases(self, **kwargs):
tc_list = []
- for tc in self.testcase_set.all():
- test_case_type = tc.type
+ for tc in self.testcase_set.values_list("type", flat=True).distinct():
test_case_ctype = ContentType.objects.get(app_label="yaksh",
- model=test_case_type
- )
- test_case = test_case_ctype.get_object_for_this_type(
+ model=tc)
+ test_case = test_case_ctype.get_all_objects_for_this_type(
question=self,
**kwargs
)
- tc_list.append(test_case)
-
+ tc_list.extend(test_case)
return tc_list
def get_test_case(self, **kwargs):
@@ -1168,8 +1165,8 @@ class StandardTestCase(TestCase):
class StdIOBasedTestCase(TestCase):
- expected_input = models.CharField(max_length=100, blank=True)
- expected_output = models.CharField(max_length=100)
+ expected_input = models.TextField(max_length=100, blank=True)
+ expected_output = models.TextField(max_length=100)
weight = models.IntegerField(default=1.0)
def get_field_value(self):