

@transaction.atomic
def form_valid(self, form):
    saved_objects = []
    args = [form.cleaned_data[field['field']] for field in self.fields]
    for data in zip(*args):
        for field in self._get_ancestors_pointers(self.obj):
            setattr(self.obj, field, None)
        self.obj.id = self.obj.pk = None
        for field in self.clear_fields:
            setattr(self.obj, field['field'], field['value'])
        for (i, field) in enumerate(self.fields):
            setattr(self.obj, form['field'], data[i])
        try:
            self.obj.clean()
        except ValidationError as exc:
            for error in exc:
                form.add_error(error[0], error[1])
            return self.form_invalid(form)
        self.obj.save()
        saved_objects.append('<a href="{}">{}</a>'.format(self.obj.get_absolute_url(), str(self.obj)))
    messages.success(self.request, mark_safe((_('Saved %(count)d object(s): %(objects)s') % {
        'count': len(saved_objects),
        'objects': ', '.join(saved_objects),
    })))
    return HttpResponseRedirect(self.get_url_name())

dataset/ETHPy150Open allegro/ralph/src/ralph/admin/views/multiadd.py MultiAddView.form_valid/VarMisuse@142/165 `field`->`form`