mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-15 16:22:18 -06:00
#20383 clear rack face if no rack on edit
This commit is contained in:
@@ -722,6 +722,16 @@ class DeviceForm(TenancyForm, PrimaryModelForm):
|
||||
if position:
|
||||
self.fields['position'].widget.choices = [(position, f'U{position}')]
|
||||
|
||||
def clean(self):
|
||||
super().clean()
|
||||
|
||||
# If rack is cleared, also clear position and face
|
||||
if not self.cleaned_data.get('rack'):
|
||||
self.cleaned_data['position'] = None
|
||||
self.cleaned_data['face'] = ''
|
||||
|
||||
return self.cleaned_data
|
||||
|
||||
|
||||
class ModuleForm(ModuleCommonForm, PrimaryModelForm):
|
||||
device = DynamicModelChoiceField(
|
||||
|
||||
Reference in New Issue
Block a user