diff options
author | ankitjavalkar | 2018-03-06 20:47:42 +0530 |
---|---|---|
committer | ankitjavalkar | 2018-03-07 12:37:44 +0530 |
commit | 88fbad3f08dfcf8d139f8bc572860469c64e3104 (patch) | |
tree | cf24a8327c677241216cc36be8a268e28a746cc0 /yaksh/views.py | |
parent | 73d6da4bca9b604a3fe68b8ce843791c948ae285 (diff) | |
download | online_test-88fbad3f08dfcf8d139f8bc572860469c64e3104.tar.gz online_test-88fbad3f08dfcf8d139f8bc572860469c64e3104.tar.bz2 online_test-88fbad3f08dfcf8d139f8bc572860469c64e3104.zip |
Multiple fixes:
- Add views test cases in test_views.py
- Add minutes unit to preview_questionpaper template
- Add error handling in views when random user accesses questionpaper
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 94335a2..2b3c891 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1883,7 +1883,7 @@ def create_demo_course(request): user = request.user ci = RequestContext(request) if not is_moderator(user): - raise("You are not allowed to view this page") + raise Http404("You are not allowed to view this page") demo_course = Course() success = demo_course.create_demo(user) if success: @@ -2754,6 +2754,8 @@ def preview_questionpaper(request, questionpaper_id): if not is_moderator(user): raise Http404('You are not allowed to view this page!') paper = QuestionPaper.objects.get(id=questionpaper_id) + if not paper.quiz.creator == user: + raise Http404('This questionpaper does not belong to you') context = { 'questions': paper._get_questions_for_answerpaper(), 'paper': paper, |