diff options
author | ankitjavalkar | 2017-04-12 19:03:43 +0530 |
---|---|---|
committer | ankitjavalkar | 2017-04-28 17:16:45 +0530 |
commit | fd4198167dd4caea0ed9a56f02e82f424495f7b9 (patch) | |
tree | 6daf3cab464603a19382a6c091cc7dc6e2ea113d /yaksh/views.py | |
parent | b285378b2eca29e7125bf9474cd57c973a202f37 (diff) | |
download | online_test-fd4198167dd4caea0ed9a56f02e82f424495f7b9.tar.gz online_test-fd4198167dd4caea0ed9a56f02e82f424495f7b9.tar.bz2 online_test-fd4198167dd4caea0ed9a56f02e82f424495f7b9.zip |
Add feature to allow cloning a course
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/') |