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

3950 not retain device type

This commit is contained in:
kobayashi
2020-01-18 07:37:06 -05:00
parent 629712142f
commit 9694bacb69
4 changed files with 22 additions and 4 deletions

View File

@@ -1636,6 +1636,7 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldForm):
instance = kwargs.get('instance')
if 'initial' not in kwargs:
kwargs['initial'] = {}
# Using hasattr() instead of "is not None" to avoid RelatedObjectDoesNotExist on required field
if instance and hasattr(instance, 'device_type'):
kwargs['initial']['manufacturer'] = instance.device_type.manufacturer

View File

@@ -1409,7 +1409,7 @@ class Device(ChangeLoggedModel, ConfigContextModel, CustomFieldModel):
'site', 'rack_group', 'rack_name', 'position', 'face', 'comments',
]
clone_fields = [
'device_type', 'device_role', 'tenant', 'platform', 'site', 'rack', 'status', 'cluster',
'device_type', 'device_type__manufacturer', 'device_role', 'tenant', 'platform', 'site', 'rack', 'status', 'cluster', 'cluster__group',
]
STATUS_CLASS_MAP = {