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

Corrects a device_type error introduced in c643e3a74f6718fd4c5a98ee0ad1da8e096582ea

This commit is contained in:
Jeremy Stretch
2016-07-20 10:10:31 -04:00
parent b8d7dd170e
commit 19d7caf1da

View File

@ -396,8 +396,8 @@ class DeviceForm(forms.ModelForm, BootstrapMixin):
self.fields['rack'].choices = []
# Rack position
pk = self.instance.pk if self.instance.pk else None
try:
pk = self.instance.pk if self.instance.pk else None
if self.is_bound and self.data.get('rack') and str(self.data.get('face')):
position_choices = Rack.objects.get(pk=self.data['rack'])\
.get_rack_units(face=self.data.get('face'), exclude=pk)
@ -426,7 +426,7 @@ class DeviceForm(forms.ModelForm, BootstrapMixin):
self.fields['device_type'].choices = []
# Disable rack assignment if this is a child device installed in a parent device
if self.instance.device_type.is_child_device and hasattr(self.instance, 'parent_bay'):
if pk and self.instance.device_type.is_child_device and hasattr(self.instance, 'parent_bay'):
self.fields['site'].disabled = True
self.fields['rack'].disabled = True