def update_case_group_form(self): initial = { 'name': self.case_group.name, 'item_id': self.case_group._id, } if self.is_case_group_update: return UpdateCaseGroupForm(self.request.POST, initial=initial) return UpdateCaseGroupForm(initial=initial)
def get_update_form(self, initial_data=None): if self.request.method == 'POST' and self.action == 'update': return UpdateCaseGroupForm(self.request.POST) return UpdateCaseGroupForm(initial=initial_data)