diff options
author | Prabhu Ramachandran | 2016-12-27 23:55:14 +0530 |
---|---|---|
committer | GitHub | 2016-12-27 23:55:14 +0530 |
commit | 011ca73b4c1042ceb208974e57c11474ecea65f2 (patch) | |
tree | 184452e83e9f35dbb356c0b4b411f38e5bea6ffd /yaksh | |
parent | 48df2c1b30fa4bfc256399bbaadcbdefa555623d (diff) | |
parent | b582c624a7c49e3312e07196df87f26180a520c2 (diff) | |
download | online_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.py | 15 |
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): |