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

Introduce ServiceTemplate

This commit is contained in:
jeremystretch
2022-01-12 16:42:28 -05:00
parent c8713d94d8
commit 97e7ef9a3f
24 changed files with 427 additions and 40 deletions

View File

@@ -31,6 +31,7 @@ __all__ = (
'RoleForm',
'RouteTargetForm',
'ServiceForm',
'ServiceTemplateForm',
'VLANForm',
'VLANGroupForm',
'VRFForm',
@@ -815,6 +816,27 @@ class VLANForm(TenancyForm, CustomFieldModelForm):
}
class ServiceTemplateForm(CustomFieldModelForm):
ports = NumericArrayField(
base_field=forms.IntegerField(
min_value=SERVICE_PORT_MIN,
max_value=SERVICE_PORT_MAX
),
help_text="Comma-separated list of one or more port numbers. A range may be specified using a hyphen."
)
tags = DynamicModelMultipleChoiceField(
queryset=Tag.objects.all(),
required=False
)
class Meta:
model = ServiceTemplate
fields = ('name', 'protocol', 'ports', 'description', 'tags')
widgets = {
'protocol': StaticSelect(),
}
class ServiceForm(CustomFieldModelForm):
device = DynamicModelChoiceField(
queryset=Device.objects.all(),