فهرست منبع

Avoid checking `field` twice on all iterations

Yields a small performance improvement

Co-authored-by: Jeremy Stretch <jeremy.stretch@networktocode.com>

Jonathan Senecal 5 سال پیش
والد
کامیت
25cbab2ea4
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      netbox/utilities/views.py

+ 1 - 1
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)))