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

#7844: Allow installing modules via UI without replicating components

This commit is contained in:
jeremystretch
2022-02-04 11:51:30 -05:00
parent 60e87cd496
commit a2981870ce
6 changed files with 88 additions and 18 deletions

View File

@@ -8,6 +8,7 @@ from utilities.forms import (
)
__all__ = (
'ComponentTemplateCreateForm',
'DeviceComponentCreateForm',
'DeviceTypeComponentCreateForm',
'FrontPortCreateForm',
@@ -51,6 +52,18 @@ class DeviceTypeComponentCreateForm(ComponentCreateForm):
field_order = ('device_type', 'name_pattern', 'label_pattern')
class ComponentTemplateCreateForm(ComponentCreateForm):
device_type = DynamicModelChoiceField(
queryset=DeviceType.objects.all(),
required=False
)
module_type = DynamicModelChoiceField(
queryset=ModuleType.objects.all(),
required=False
)
field_order = ('device_type', 'module_type', 'name_pattern', 'label_pattern')
class DeviceComponentCreateForm(ComponentCreateForm):
device = DynamicModelChoiceField(
queryset=Device.objects.all()