mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Fixes #10383: Fix assignment of component templates to module types via web UI
This commit is contained in:
parent
59388d89a0
commit
4a9831bd23
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#10383](https://github.com/netbox-community/netbox/issues/10383) - Fix assignment of component templates to module types via web UI
|
||||||
* [#10387](https://github.com/netbox-community/netbox/issues/10387) - Fix `MultiValueDictKeyError` exception when editing a device interface
|
* [#10387](https://github.com/netbox-community/netbox/issues/10387) - Fix `MultiValueDictKeyError` exception when editing a device interface
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -1000,11 +1000,22 @@ class ComponentTemplateForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
|
|
||||||
class ModularComponentTemplateForm(ComponentTemplateForm):
|
class ModularComponentTemplateForm(ComponentTemplateForm):
|
||||||
|
device_type = DynamicModelChoiceField(
|
||||||
|
queryset=DeviceType.objects.all().all(),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
module_type = DynamicModelChoiceField(
|
module_type = DynamicModelChoiceField(
|
||||||
queryset=ModuleType.objects.all(),
|
queryset=ModuleType.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
# Disable reassignment of ModuleType when editing an existing instance
|
||||||
|
if self.instance.pk:
|
||||||
|
self.fields['module_type'].disabled = True
|
||||||
|
|
||||||
|
|
||||||
class ConsolePortTemplateForm(ModularComponentTemplateForm):
|
class ConsolePortTemplateForm(ModularComponentTemplateForm):
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
|
Loading…
Reference in New Issue
Block a user