From 943d2c1f6d0a1f99ffc6e48bc0c82249e2d4d08c Mon Sep 17 00:00:00 2001 From: adityacp Date: Fri, 12 Jan 2018 17:33:16 +0530 Subject: Change in models.py, views.py and urls.py - Add new model methods to calculate percent of module and course completion - Add new view function for displaying course status - Add new url to redirect to course status --- yaksh/views.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'yaksh/views.py') diff --git a/yaksh/views.py b/yaksh/views.py index 49249ca..7049912 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -2666,3 +2666,20 @@ def course_modules(request, course_id, msg=None): context = {"course": course, "learning_modules": learning_modules, "user": user, "msg": msg} return my_render_to_response('yaksh/course_modules.html', context) + + +@login_required +@email_verified +def course_status(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('This course does not belong to you') + students = course.get_only_students() + context = { + 'course': course, 'students': students, + 'state': 'course_status', 'modules': course.get_learning_modules() + } + return my_render_to_response('yaksh/course_detail.html', context) -- cgit