Skip to content

Commit

Permalink
fixed error display on parent import form #15185
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi1693 committed Feb 21, 2024
1 parent f751afc commit 2a14c13
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions netbox/netbox/views/generic/bulk_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def _get_form_fields(self):
if type(field.widget) is not HiddenInput
}

def _save_object(self, model_form, request):
def _save_object(self, parent_form, model_form, request):

# Save the primary object
obj = self.save_object(model_form, request)
Expand Down Expand Up @@ -350,7 +350,7 @@ def _save_object(self, model_form, request):
for subfield_name, errors in f.errors.items():
for err in errors:
err_msg = "{}[{}] {}: {}".format(field_name, i, subfield_name, err)
model_form.add_error(None, err_msg)
parent_form.add_error(None, err_msg)
raise AbortTransaction()

# Enforce object-level permissions on related objects
Expand Down Expand Up @@ -417,7 +417,7 @@ def create_and_update_objects(self, form, request):
restrict_form_fields(model_form, request.user)

if model_form.is_valid():
obj = self._save_object(model_form, request)
obj = self._save_object(form, model_form, request)
saved_objects.append(obj)
else:
# Replicate model form errors for display
Expand Down

0 comments on commit 2a14c13

Please sign in to comment.