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