summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2016-04-28 12:22:30 +0530
committeradityacp2016-04-28 12:22:30 +0530
commit3438ca95172897b594c216967d51cf5771d75f73 (patch)
tree29567883d637b65deabcfb3a858730d8d1c97f99 /yaksh/views.py
parent6b09383890b8367628124a854810326d7bbac7c4 (diff)
downloadonline_test-3438ca95172897b594c216967d51cf5771d75f73.tar.gz
online_test-3438ca95172897b594c216967d51cf5771d75f73.tar.bz2
online_test-3438ca95172897b594c216967d51cf5771d75f73.zip
further commented changes
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index dd8cc2b..3823976 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -608,12 +608,11 @@ def courses(request):
def course_detail(request, course_id):
user = request.user
ci = RequestContext(request)
- if not is_moderator(user):
- raise Http404('You are not allowed to view this page')
course = Course.objects.filter(Q(creator=user)|Q(teachers=user),
pk=course_id).first()
- if user != course.creator and user not in course.teachers.all():
+ if not is_moderator(user) or not course:
raise Http404('You are not allowed to view this page')
+
return my_render_to_response('yaksh/course_detail.html', {'course': course},
context_instance=ci)
@@ -843,7 +842,8 @@ def download_csv(request, questionpaper_id):
if not is_moderator(user):
raise Http404('You are not allowed to view this page!')
quiz = Quiz.objects.get(questionpaper=questionpaper_id)
- if quiz.course.creator != user and user not in quiz.course.teachers.all():
+
+ if not quiz.course.is_creator(user) and not quiz.course.is_teacher(user):
raise Http404('The question paper does not belong to your course')
papers = AnswerPaper.objects.get_latest_attempts(questionpaper_id)
if not papers:
@@ -1098,7 +1098,7 @@ def add_teacher(request, course_id):
@login_required
-def view_courses(request):
+def allotted_courses(request):
""" show courses allotted to a user """
user = request.user
@@ -1113,7 +1113,7 @@ def view_courses(request):
@login_required
def remove_teachers(request, course_id):
- """ show courses allotted to a user """
+ """ remove user from a course """
user = request.user
if not is_moderator(user):