Prechádzať zdrojové kódy

#11902 validate device on inventory item import

Arthur 2 rokov pred
rodič
commit
1ad029712e
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  1. 1 1
      netbox/dcim/forms/bulk_import.py

+ 1 - 1
netbox/dcim/forms/bulk_import.py

@@ -928,7 +928,7 @@ class InventoryItemImportForm(NetBoxModelImportForm):
         component_name = self.cleaned_data.get('component_name')
         component_name = self.cleaned_data.get('component_name')
         device = self.cleaned_data.get("device")
         device = self.cleaned_data.get("device")
 
 
-        if not device and hasattr(self, 'instance'):
+        if not device and hasattr(self, 'instance') and hasattr(self.instance, 'device'):
             device = self.instance.device
             device = self.instance.device
 
 
         if not all([device, content_type, component_name]):
         if not all([device, content_type, component_name]):