diff options
author | adityacp | 2018-02-22 18:05:00 +0530 |
---|---|---|
committer | adityacp | 2018-02-22 18:05:00 +0530 |
commit | 333859a8c1ab57e70ea57e92a22eaac6a1a1c0ac (patch) | |
tree | 6f7fa9bc81b7713b87f111c773e0718bfbd4bbeb /yaksh | |
parent | 2a46206abfd04509707f7bf21a9f6dbc1b2b6b82 (diff) | |
download | online_test-333859a8c1ab57e70ea57e92a22eaac6a1a1c0ac.tar.gz online_test-333859a8c1ab57e70ea57e92a22eaac6a1a1c0ac.tar.bz2 online_test-333859a8c1ab57e70ea57e92a22eaac6a1a1c0ac.zip |
Change templates, test_views.py, urls.py, views.py
- Change copy_type to shallow and deep
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/templates/yaksh/courses.html | 6 | ||||
-rw-r--r-- | yaksh/templates/yaksh/design_course_session.html | 4 | ||||
-rw-r--r-- | yaksh/test_views.py | 8 | ||||
-rw-r--r-- | yaksh/urls.py | 2 | ||||
-rw-r--r-- | yaksh/views.py | 22 |
5 files changed, 21 insertions, 21 deletions
diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html index 9c00957..b19f094 100644 --- a/yaksh/templates/yaksh/courses.html +++ b/yaksh/templates/yaksh/courses.html @@ -133,12 +133,12 @@ </li> <br> <li> - <a class="test" href="{{URL_ROOT}}/exam/manage/duplicate_course/copy/{{ course.id }}/" data-toggle="tooltip" title="Creates a new copy and link modules of selected course to the copy" data-placement="top"> + <a class="test" href="{{URL_ROOT}}/exam/manage/duplicate_course/shallow/{{ course.id }}/" data-toggle="tooltip" title="Creates a new copy and link modules of selected course to the copy" data-placement="top"> Copy Course</a> </li> <br> <li> - <a class="test" href="{{URL_ROOT}}/exam/manage/duplicate_course/clone/{{ course.id }}/" data-toggle="tooltip" title="Creates Copy of selected Course as well as its Modules, Lessons/Quizzes" data-placement="top"> + <a class="test" href="{{URL_ROOT}}/exam/manage/duplicate_course/deep/{{ course.id }}/" data-toggle="tooltip" title="Creates Copy of selected Course as well as its Modules, Lessons/Quizzes" data-placement="top"> Clone Course</a> </li> </ul> @@ -274,7 +274,7 @@ </li> <br> <li> - <a class="test" href="{{URL_ROOT}}/exam/manage/duplicate_course/clone/{{ course.id }}/" data-toggle="tooltip" title="Creates Copy of selected Course as well as its Modules, Lessons/Quizzes" data-placement="top"> + <a class="test" href="{{URL_ROOT}}/exam/manage/duplicate_course/deep/{{ course.id }}/" data-toggle="tooltip" title="Creates Copy of selected Course as well as its Modules, Lessons/Quizzes" data-placement="top"> Clone Course</a> </li> </ul> diff --git a/yaksh/templates/yaksh/design_course_session.html b/yaksh/templates/yaksh/design_course_session.html index ee530e0..6542e3c 100644 --- a/yaksh/templates/yaksh/design_course_session.html +++ b/yaksh/templates/yaksh/design_course_session.html @@ -23,7 +23,7 @@ <div class="row"> <div class="col-md-8 col-md-offset-2 available-list"> <div id="fixed-available-wrapper"> - <p><u><b>Available Lessons and quizzes: (Add Lessons and Quizzes)</b></u></p> + <p><u><b>Available Modules:</b></u></p> <div id="fixed-available"> <table id="course-details" class="table table-bordered"> <tr> @@ -64,7 +64,7 @@ </div> <div class="col-md-8 col-md-offset-2"> <div id="fixed-added-wrapper"> - <p><u><b>Choosen Lessons and quizzes:</b></u></p> + <p><u><b>Choosen Modules:</b></u></p> <div id="fixed-added"> <table id="course-details" class="table table-bordered"> <tr> diff --git a/yaksh/test_views.py b/yaksh/test_views.py index fb33114..8695479 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -1871,7 +1871,7 @@ class TestCourses(TestCase): response = self.client.get( reverse('yaksh:duplicate_course', kwargs={"course_id": self.user2_course.id, - "copy_type": "copy"}), + "copy_type": "shallow"}), follow=True ) self.assertEqual(response.status_code, 404) @@ -1886,7 +1886,7 @@ class TestCourses(TestCase): response = self.client.get( reverse('yaksh:duplicate_course', kwargs={"course_id": self.user2_course.id, - "copy_type": "copy"}), + "copy_type": "shallow"}), follow=True ) err_msg = "You do not have permissions" @@ -1904,7 +1904,7 @@ class TestCourses(TestCase): response = self.client.get( reverse('yaksh:duplicate_course', kwargs={"course_id": self.user2_course.id, - "copy_type": "copy"}), + "copy_type": "shallow"}), follow=True ) @@ -1937,7 +1937,7 @@ class TestCourses(TestCase): response = self.client.get( reverse('yaksh:duplicate_course', kwargs={"course_id": self.user1_course.id, - "copy_type": "clone"}), + "copy_type": "deep"}), follow=True ) diff --git a/yaksh/urls.py b/yaksh/urls.py index b1e6249..473a854 100644 --- a/yaksh/urls.py +++ b/yaksh/urls.py @@ -86,7 +86,7 @@ urlpatterns = [ views.show_statistics, name="show_statistics"), url(r'^manage/download_quiz_csv/(?P<course_id>\d+)/(?P<quiz_id>\d+)/$', views.download_quiz_csv, name="download_quiz_csv"), - url(r'^manage/duplicate_course/(?P<copy_type>copy|clone)/(?P<course_id>\d+)/$', + url(r'^manage/duplicate_course/(?P<copy_type>shallow|deep)/(?P<course_id>\d+)/$', views.duplicate_course, name='duplicate_course'), url(r'manage/courses/$', views.courses, name='courses'), url(r'manage/add_course/$', views.add_course, name='add_course'), diff --git a/yaksh/views.py b/yaksh/views.py index 62a448c..b4b0c76 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -399,18 +399,18 @@ def prof_manage(request, msg=None): if request.method == "POST": delete_paper = request.POST.getlist('delete_paper') for answerpaper_id in delete_paper: - answerpaper = AnswerPaper.objects.filter(id=answerpaper_id) - if answerpaper.exists(): - qpaper = answerpaper.first().question_paper - answerpaper.first().course.remove_trial_modules() - answerpaper.first().course.delete() - if qpaper.quiz.is_trial: + answerpaper = AnswerPaper.objects.get(id=answerpaper_id) + qpaper = answerpaper.question_paper + answerpaper.course.remove_trial_modules() + answerpaper.course.delete() + if qpaper.quiz.is_trial: + qpaper.quiz.delete() + else: + if qpaper.answerpaper_set.count() == 1: qpaper.quiz.delete() else: - if qpaper.answerpaper_set.count() == 1: - qpaper.quiz.delete() - else: - answerpaper.delete() + answerpaper.delete() + context = {'user': user, 'courses': courses, 'trial_paper': trial_paper, 'msg': msg } @@ -2253,7 +2253,7 @@ def duplicate_course(request, copy_type, course_id): raise Http404('You are not allowed to view this page!') if course.is_teacher(user) or course.is_creator(user): - if copy_type == "copy": + if copy_type == "shallow": # Link all the modules from current course to copied course course.create_duplicate_course(user) else: |