Parcourir la source

Fixes #872: TypeError on bulk IP address creation (Python 3)

Jeremy Stretch il y a 8 ans
Parent
commit
0e5138d6ec
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      netbox/utilities/views.py

+ 3 - 2
netbox/utilities/views.py

@@ -307,11 +307,12 @@ class BulkAddView(View):
         if form.is_valid():
 
             # The first field will be used as the pattern
-            pattern_field = form.fields.keys()[0]
+            field_names = list(form.fields.keys())
+            pattern_field = field_names[0]
             pattern = form.cleaned_data[pattern_field]
 
             # All other fields will be copied as object attributes
-            kwargs = {k: form.cleaned_data[k] for k in form.fields.keys()[1:]}
+            kwargs = {k: form.cleaned_data[k] for k in field_names[1:]}
 
             new_objs = []
             try: