diff options
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/models.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 949b87e..813453d 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1426,6 +1426,19 @@ class Question(models.Model): tc_list.extend(test_case) return tc_list + def get_test_cases_as_dict(self, **kwargs): + tc_list = [] + for tc in self.testcase_set.values_list("type", flat=True).distinct(): + test_case_ctype = ContentType.objects.get(app_label="yaksh", + model=tc) + test_case = test_case_ctype.get_all_objects_for_this_type( + question=self, + **kwargs + ) + for tc in test_case: + tc_list.append(model_to_dict(tc)) + return tc_list + def get_test_case(self, **kwargs): for tc in self.testcase_set.all(): test_case_type = tc.type |