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

Fixes #1334: Fix server error when adding an interface to a device

This commit is contained in:
Jeremy Stretch
2017-07-11 14:52:50 -04:00
parent 2d0638821d
commit 74828e1409
4 changed files with 6 additions and 6 deletions

View File

@@ -630,7 +630,7 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldForm):
instance = kwargs.get('instance')
# Using hasattr() instead of "is not None" to avoid RelatedObjectDoesNotExist on required field
if instance and hasattr(instance, 'device_type'):
initial = kwargs.get('initial', {})
initial = kwargs.get('initial', {}).copy()
initial['manufacturer'] = instance.device_type.manufacturer
kwargs['initial'] = initial
@@ -1479,7 +1479,7 @@ class InterfaceCreateForm(DeviceComponentForm):
def __init__(self, *args, **kwargs):
# Set interfaces enabled by default
kwargs['initial'] = kwargs.get('initial', {})
kwargs['initial'] = kwargs.get('initial', {}).copy()
kwargs['initial'].update({'enabled': True})
super(InterfaceCreateForm, self).__init__(*args, **kwargs)