1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #2491: Fix exception when importing devices with invalid device type

This commit is contained in:
Jeremy Stretch
2018-10-05 12:22:46 -04:00
parent 5d10d8418e
commit 841db3b0c2
2 changed files with 2 additions and 1 deletions

View File

@@ -1400,7 +1400,7 @@ class Device(ChangeLoggedModel, ConfigContextModel, CustomFieldModel):
})
# Validate manufacturer/platform
if self.device_type and self.platform:
if hasattr(self, 'device_type') and self.platform:
if self.platform.manufacturer and self.platform.manufacturer != self.device_type.manufacturer:
raise ValidationError({
'platform': "The assigned platform is limited to {} device types, but this device's type belongs "