From 25cbab2ea4b5c8a9b79ed67759bf9ad155aad595 Mon Sep 17 00:00:00 2001 From: Jonathan Senecal Date: Wed, 10 Jun 2020 22:16:46 -0400 Subject: [PATCH] Avoid checking `field` twice on all iterations Yields a small performance improvement Co-authored-by: Jeremy Stretch --- netbox/utilities/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/utilities/views.py b/netbox/utilities/views.py index 1fe407dad..ee39707e8 100644 --- a/netbox/utilities/views.py +++ b/netbox/utilities/views.py @@ -937,7 +937,7 @@ class ComponentCreateView(GetReturnURLMixin, View): # Assign errors on the child form's name/label field to name_pattern/label_pattern on the parent form if field == 'name': field = 'name_pattern' - if field == 'label': + elif field == 'label': field = 'label_pattern' for e in errors: form.add_error(field, '{}: {}'.format(name, ', '.join(e)))