diff options
author | Prabhu Ramachandran | 2018-03-21 18:18:19 +0530 |
---|---|---|
committer | GitHub | 2018-03-21 18:18:19 +0530 |
commit | cb6b1aad8f77035d1bfb598d8b70c51c23c435d7 (patch) | |
tree | 4720cf32e5e24c562ca6aad5f3c10ed062863c5e /yaksh/views.py | |
parent | bff8d493aa2c83e971b067daf103e38b4392c4b9 (diff) | |
parent | 0ae21e437775b056d346311bd9f50220e5d9fb28 (diff) | |
download | online_test-cb6b1aad8f77035d1bfb598d8b70c51c23c435d7.tar.gz online_test-cb6b1aad8f77035d1bfb598d8b70c51c23c435d7.tar.bz2 online_test-cb6b1aad8f77035d1bfb598d8b70c51c23c435d7.zip |
Merge pull request #446 from adityacp/fix_clone_course
Fix clone course
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 27a07d2..ec1807c 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -390,8 +390,8 @@ def prof_manage(request, msg=None): return my_redirect('/exam/login') if not is_moderator(user): return my_redirect('/exam/') - courses = Course.objects.filter(creator=user, is_trial=False) - + courses = Course.objects.filter(Q(creator=user) | Q(teachers=user), + is_trial=False) trial_paper = AnswerPaper.objects.filter( user=user, question_paper__quiz__is_trial=True, course__is_trial=True @@ -410,6 +410,7 @@ def prof_manage(request, msg=None): qpaper.quiz.delete() else: answerpaper.delete() + context = {'user': user, 'courses': courses, 'trial_paper': trial_paper, 'msg': msg } @@ -2255,10 +2256,15 @@ def duplicate_course(request, course_id): raise Http404('You are not allowed to view this page!') if course.is_teacher(user) or course.is_creator(user): + # Create new entries of modules, lessons/quizzes + # from current course to copied course course.create_duplicate_course(user) else: - msg = 'You do not have permissions to clone this course, please contact your '\ - 'instructor/administrator.' + msg = dedent( + '''\ + You do not have permissions to clone {0} course, please contact + your instructor/administrator.'''.format(course.name) + ) return complete(request, msg, attempt_num=None, questionpaper_id=None) return my_redirect('/exam/manage/courses/') |