diff options
author | ankitjavalkar | 2020-06-08 11:20:48 +0530 |
---|---|---|
committer | ankitjavalkar | 2020-06-08 11:20:48 +0530 |
commit | fe70769afcdf239577d59e330e32306d14107a48 (patch) | |
tree | e7881a8a40786ccd6273cdb3d882bf2e2a9eabbe /yaksh | |
parent | 0b72c7dd886707b6e9366fd4b4f012dd03fe799c (diff) | |
download | online_test-fe70769afcdf239577d59e330e32306d14107a48.tar.gz online_test-fe70769afcdf239577d59e330e32306d14107a48.tar.bz2 online_test-fe70769afcdf239577d59e330e32306d14107a48.zip |
- Remove Copy Of in Module, Lesson and Quiz names when duplicating courses
- Prevent student users from accessing Questions
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/models.py | 6 | ||||
-rw-r--r-- | yaksh/views.py | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 7d4dd98..e86472c 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -296,7 +296,7 @@ class Lesson(models.Model): lesson_files = self.get_files() new_lesson = self new_lesson.id = None - new_lesson.name = "Copy of {0}".format(self.name) + new_lesson.name = self.name new_lesson.creator = user new_lesson.save() for _file in lesson_files: @@ -575,7 +575,7 @@ class Quiz(models.Model): question_papers = self.questionpaper_set.all() new_quiz = self new_quiz.id = None - new_quiz.description = "Copy of {0}".format(self.description) + new_quiz.description = self.description new_quiz.creator = user new_quiz.save() for qp in question_papers: @@ -932,7 +932,7 @@ class Course(models.Model): copy_course_name = "Copy Of {0}".format(self.name) new_course = self._create_duplicate_instance(user, copy_course_name) for module in learning_modules: - copy_module_name = "Copy of {0}".format(module.name) + copy_module_name = module.name new_module = module._create_module_copy(user, copy_module_name) new_course.learning_module.add(new_module) return new_course diff --git a/yaksh/views.py b/yaksh/views.py index 3adb536..1544508 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -224,6 +224,9 @@ def results_user(request): @email_verified def add_question(request, question_id=None): user = request.user + if not is_moderator(user): + raise Http404('You are not allowed to view this page !') + test_case_type = None if question_id is not None: |