diff --git a/generic/views.py b/generic/views.py index cefd60f3..0d4a02d5 100644 --- a/generic/views.py +++ b/generic/views.py @@ -768,6 +768,12 @@ class ExamCloneMixin(): questions = old_object.exam_questions.all().values_list("id", flat=True) - initial_data["exam_questions"] = list(questions) + self.exam_questions = list(questions) - return initial_data \ No newline at end of file + return initial_data + + def form_valid(self, form): + object = form.save() + object.exam_questions = self.exam_questions + object.save() + return HttpResponseRedirect(self.get_success_url()) \ No newline at end of file diff --git a/rapids/forms.py b/rapids/forms.py index 8d2ac962..5c516529 100755 --- a/rapids/forms.py +++ b/rapids/forms.py @@ -214,4 +214,4 @@ AnswerUpdateFormSet = inlineformset_factory( class ExamForm(ModelForm): class Meta: model = Exam - fields = ["name", "time_limit", "exam_mode", "active", "archive", "exam_questions"] \ No newline at end of file + fields = ["name", "time_limit", "exam_mode", "active", "archive"] \ No newline at end of file