diff options
author | adityacp | 2017-04-04 10:35:05 +0530 |
---|---|---|
committer | adityacp | 2017-04-04 10:35:05 +0530 |
commit | c1bdc56f889e60a246e6fccb450f339b68897395 (patch) | |
tree | bed0a7461589c92fbadd5653c433fff840d184d7 | |
parent | e9d8be7cfd031c156da153d59355e49cb7d2071a (diff) | |
download | online_test-c1bdc56f889e60a246e6fccb450f339b68897395.tar.gz online_test-c1bdc56f889e60a246e6fccb450f339b68897395.tar.bz2 online_test-c1bdc56f889e60a246e6fccb450f339b68897395.zip |
Check if user is teacher or moderator for creating QuestionPaper
-rw-r--r-- | yaksh/views.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 2adc2c3..247aca4 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -661,8 +661,7 @@ def course_detail(request, course_id): raise Http404('You are not allowed to view this page') course = get_object_or_404(Course, pk=course_id) - if not course.is_creator(user) and not course.is_teacher(user): - raise Http404('This course does not belong to you') + return my_render_to_response('yaksh/course_detail.html', {'course': course}, context_instance=ci) @@ -859,7 +858,9 @@ def design_questionpaper(request, quiz_id, questionpaper_id=None): if not is_moderator(user): raise Http404('You are not allowed to view this page!') - + quiz = Quiz.objects.get(id=quiz_id) + if not quiz.course.is_creator(user) and not quiz.course.is_teacher(user): + raise Http404('This course does not belong to you') filter_form = QuestionFilterForm(user=user) questions = None marks = None |