def _clone_sub_sections(self): sub_sections_map = {} fields = ['title', 'description', 'order'] for old_section, new_section in self.sections.items(): sub_sections = old_section.sub_sections.all() sub_sections_map.update(create_copies(sub_sections, fields, section=new_section)) return sub_sections_map
def _clone_question_groups(self): question_groups_map = {} fields = ['name', 'instructions', 'parent', 'order', 'allow_multiples'] for old_sub_section, new_sub_section in self.sub_sections.items(): question_groups = old_sub_section.all_question_groups() question_groups_map.update(create_copies(question_groups, fields, subsection=new_sub_section)) return question_groups_map
def _clone_sections(self): sections = self.original_questionnaire.sections.all() fields = ['name', 'title', 'description', 'order'] return create_copies(sections, fields, questionnaire=self.questionnaire)