summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorankitjavalkar2016-04-29 11:23:07 +0530
committerankitjavalkar2016-05-05 19:21:34 +0530
commit34fb6b71ce5fcbd9a5537b305504cadaeb86d9a3 (patch)
tree769c50fc9825ee73eeb7d844db3676a06f2e4e67 /yaksh/models.py
parent5967e0e1cce19d356ba622719b332f776127b277 (diff)
downloadonline_test-34fb6b71ce5fcbd9a5537b305504cadaeb86d9a3.tar.gz
online_test-34fb6b71ce5fcbd9a5537b305504cadaeb86d9a3.tar.bz2
online_test-34fb6b71ce5fcbd9a5537b305504cadaeb86d9a3.zip
- Modify question - answer validation in views
- Modify show_question to include test_cases in template context - Modify question display template - Minor changes in forms and urls for proper rebasing
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index d15fdf2..fa4121d 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -250,6 +250,7 @@ class Question(models.Model):
return json.dumps(question_data)
+<<<<<<< HEAD
def dump_into_json(self, question_ids, user):
questions = Question.objects.filter(id__in = question_ids, user_id = user.id)
questions_dict = []
@@ -270,15 +271,18 @@ class Question(models.Model):
question['user'] = user
Question.objects.get_or_create(**question)
- def get_test_cases(self):
+ def get_test_cases(self, **kwargs):
test_case_ctype = ContentType.objects.get(app_label="yaksh", model=self.test_case_type)
- test_cases = test_case_ctype.get_all_objects_for_this_type(question=self)
+ test_cases = test_case_ctype.get_all_objects_for_this_type(question=self, **kwargs)
return test_cases
- def get_test_case(self, test_case_id):
+ # def get_test_case(self, test_case_id):
+ # test_case_ctype = ContentType.objects.get(app_label="yaksh", model=self.test_case_type)
+ # test_case = test_case_ctype.get_object_for_this_type(question=self, id=test_case_id)
+ def get_test_case(self, **kwargs):
test_case_ctype = ContentType.objects.get(app_label="yaksh", model=self.test_case_type)
- test_case = test_case_ctype.get_object_for_this_type(question=self, id=test_case_id)
+ test_case = test_case_ctype.get_object_for_this_type(question=self, **kwargs)
return test_case