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

Fix error when assigning a new interface to a LAG

This commit is contained in:
Jeremy Stretch
2017-03-16 22:27:01 -04:00
parent 92d726bbd4
commit 3ce2f0d100

@ -90,7 +90,12 @@ class ComponentCreateView(View):
self.parent_field: parent.pk,
'name': name,
}
component_data.update(data)
# Replace objects with their primary key to keep component_form.clean() happy
for k, v in data.items():
if hasattr(v, 'pk'):
component_data[k] = v.pk
else:
component_data[k] = v
component_form = self.model_form(component_data)
if component_form.is_valid():
new_components.append(component_form.save(commit=False))