def save(self, user=None):
        assert self.is_valid()

        to_delete = set([o.pk for o in self.get_queryset()])

        steps = []
        existing = []
        new = []
        for i, form in enumerate(self.forms, 1):
            step = form.save(commit=False)
            step.number = i
            steps.append(step)
            if step.pk:
                to_delete.remove(step.pk)
                existing.append(step)
            else:
                new.append(step)

        # first delete any existing steps that weren't in the incoming data,
        # then update existing steps on a first pass, then save new steps. This
        # dance is so we never fall afoul of the number-unique constraint (and
        # MySQL's inability to defer constraint checks)
        self.model._base_manager.filter(pk__in=to_delete).delete()

        for step in existing:
            step.save(user=user, force_update=True)

        for step in new:
            step.save(user=user, force_insert=True)

        return steps
Save all forms in this formset.
dataset/ETHPy150Open mozilla/moztrap/moztrap/view/manage/cases/forms.py/BaseStepFormSet.save