From c1bdc56f889e60a246e6fccb450f339b68897395 Mon Sep 17 00:00:00 2001 From: adityacp Date: Tue, 4 Apr 2017 10:35:05 +0530 Subject: Check if user is teacher or moderator for creating QuestionPaper --- yaksh/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'yaksh') 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 -- cgit