mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Fixes #1158: Exception thrown when creating a device component with an invalid name
This commit is contained in:
parent
088f75ba0c
commit
83688fceb7
@ -105,6 +105,9 @@ class ComponentCreateView(View):
|
||||
new_components.append(component_form.save(commit=False))
|
||||
else:
|
||||
for field, errors in component_form.errors.as_data().items():
|
||||
# Assign errors on the child form's name field to name_pattern on the parent form
|
||||
if field == 'name':
|
||||
field = 'name_pattern'
|
||||
for e in errors:
|
||||
form.add_error(field, u'{}: {}'.format(name, ', '.join(e)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user