diff options
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 4a6f462..4a97d1a 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1182,7 +1182,6 @@ def courses(request): @email_verified def course_detail(request, course_id): user = request.user - if not is_moderator(user): raise Http404('You are not allowed to view this page') @@ -1190,9 +1189,18 @@ def course_detail(request, 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( - request, 'yaksh/course_detail.html', {'course': course} - ) + enrolled_users = course.get_enrolled() + requested_users = course.get_requests() + rejected_users = course.get_rejected() + context = { + "enrolled_users": enrolled_users, + "requested_users": requested_users, + "course": course, + "rejected_users": rejected_users, + "is_students": True + } + + return my_render_to_response(request, 'yaksh/course_detail.html', context) @login_required @@ -3348,29 +3356,6 @@ def download_course(request, course_id): @login_required @email_verified -def course_students(request, course_id): - user = request.user - if not is_moderator(user): - 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("You are not allowed to view {0}".format( - course.name)) - enrolled_users = course.get_enrolled() - requested_users = course.get_requests() - rejected_users = course.get_rejected() - context = { - "enrolled_users": enrolled_users, - "requested_users": requested_users, - "course": course, - "rejected_users": rejected_users, - "is_students": True - } - return my_render_to_response(request, 'yaksh/course_detail.html', context) - - -@login_required -@email_verified def course_teachers(request, course_id): user = request.user if not is_moderator(user): |