Fixes #10383: Fix assignment of component templates to module types via web UI

This commit is contained in:
jeremystretch 2022-09-16 08:30:46 -04:00
parent 59388d89a0
commit 4a9831bd23
2 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,7 @@
### 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
---

View File

@ -1000,11 +1000,22 @@ class ComponentTemplateForm(BootstrapMixin, forms.ModelForm):
class ModularComponentTemplateForm(ComponentTemplateForm):
device_type = DynamicModelChoiceField(
queryset=DeviceType.objects.all().all(),
required=False
)
module_type = DynamicModelChoiceField(
queryset=ModuleType.objects.all(),
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):
fieldsets = (