diff options
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 35df9f9..bad91f8 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1597,3 +1597,15 @@ def download_assignment_file(request, quiz_id, question_id=None, user_id=None): ) response.write(zipfile_name.read()) return response + +@login_required +def duplicate_course(request, course_id): + user = request.user + course = get_object_or_404(Course, pk=course_id) + if not is_moderator(user): + raise Http404('You are not allowed to view this page!') + + if course.is_teacher(user) or course.is_creator(user): + course.create_duplicate_course(user) + + return my_redirect('/exam/manage/courses/') |