diff options
author | adityacp | 2018-01-12 17:33:16 +0530 |
---|---|---|
committer | adityacp | 2018-01-12 17:35:38 +0530 |
commit | 943d2c1f6d0a1f99ffc6e48bc0c82249e2d4d08c (patch) | |
tree | 1dbbb539e525d569bdf5d13bfc0f2fa849eafde8 /yaksh/views.py | |
parent | 3abbc557c57eaf2f3d08222034f9a720a1e7a1ed (diff) | |
download | online_test-943d2c1f6d0a1f99ffc6e48bc0c82249e2d4d08c.tar.gz online_test-943d2c1f6d0a1f99ffc6e48bc0c82249e2d4d08c.tar.bz2 online_test-943d2c1f6d0a1f99ffc6e48bc0c82249e2d4d08c.zip |
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
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 17 |
1 files changed, 17 insertions, 0 deletions
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) |