diff options
author | ankitjavalkar | 2020-07-30 22:14:44 +0530 |
---|---|---|
committer | ankitjavalkar | 2020-07-30 22:14:44 +0530 |
commit | 49a494849a0498e309f6c97ec6ae6ab79961b87d (patch) | |
tree | 5a69dbd6a99dd59f3345639ad632836e3b3aa8fa /yaksh | |
parent | db974d80d0ec308d17c6c0099576d24f3e0ed98a (diff) | |
download | online_test-49a494849a0498e309f6c97ec6ae6ab79961b87d.tar.gz online_test-49a494849a0498e309f6c97ec6ae6ab79961b87d.tar.bz2 online_test-49a494849a0498e309f6c97ec6ae6ab79961b87d.zip |
Make changes based on feedback
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/models.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index e86472c..87a6877 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -296,7 +296,6 @@ class Lesson(models.Model): lesson_files = self.get_files() new_lesson = self new_lesson.id = None - new_lesson.name = self.name new_lesson.creator = user new_lesson.save() for _file in lesson_files: @@ -575,7 +574,6 @@ class Quiz(models.Model): question_papers = self.questionpaper_set.all() new_quiz = self new_quiz.id = None - new_quiz.description = self.description new_quiz.creator = user new_quiz.save() for qp in question_papers: @@ -821,12 +819,13 @@ class LearningModule(models.Model): percent = round((count / units.count()) * 100) return percent - def _create_module_copy(self, user, module_name): + def _create_module_copy(self, user, module_name=None): learning_units = self.learning_unit.order_by("order") new_module = self new_module.id = None - new_module.name = module_name new_module.creator = user + if module_name: + new_module.name = module_name new_module.save() for unit in learning_units: new_unit = unit._create_unit_copy(user) @@ -933,7 +932,7 @@ class Course(models.Model): new_course = self._create_duplicate_instance(user, copy_course_name) for module in learning_modules: copy_module_name = module.name - new_module = module._create_module_copy(user, copy_module_name) + new_module = module._create_module_copy(user) new_course.learning_module.add(new_module) return new_course |