diff options
author | Prabhu Ramachandran | 2017-04-28 17:25:03 +0530 |
---|---|---|
committer | GitHub | 2017-04-28 17:25:03 +0530 |
commit | e56c50bb99a8694e8f1c8533df3f04e4613bcb08 (patch) | |
tree | 0935e7b5cdbb5d72d2c106ca7234520c985d4291 /yaksh/views.py | |
parent | b285378b2eca29e7125bf9474cd57c973a202f37 (diff) | |
parent | 3597ee5fa814b0c7c737e72797d9e9911ca5e0dd (diff) | |
download | online_test-e56c50bb99a8694e8f1c8533df3f04e4613bcb08.tar.gz online_test-e56c50bb99a8694e8f1c8533df3f04e4613bcb08.tar.bz2 online_test-e56c50bb99a8694e8f1c8533df3f04e4613bcb08.zip |
Merge pull request #277 from ankitjavalkar/course-clone
Course clone
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 35df9f9..6a4325e 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1597,3 +1597,18 @@ 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) + else: + msg = 'You do not have permissions to clone this course, please contact your '\ + 'instructor/administrator.' + return complete(request, msg, attempt_num=None, questionpaper_id=None) + return my_redirect('/exam/manage/courses/') |