From 83688fceb7ec809e57d39d2621cb6ed387e59133 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 10 May 2017 11:23:54 -0400 Subject: [PATCH] Fixes #1158: Exception thrown when creating a device component with an invalid name --- netbox/dcim/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 15755cbe9..4ffe2d36b 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -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)))