Skip to content

Commit 7adb987

Browse files
committed
feat(form): Adding new Sources to the ACLStandardRule creation form
1 parent 11912b5 commit 7adb987

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

netbox_acls/forms/models.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
from django.contrib.contenttypes.models import ContentType
77
from django.core.exceptions import ValidationError
88
from django.utils.safestring import mark_safe
9-
from ipam.models import Prefix
9+
from ipam.models import (
10+
Prefix,
11+
IPRange,
12+
IPAddress,
13+
Aggregate,
14+
Service,
15+
)
1016
from netbox.forms import NetBoxModelForm
1117
from utilities.forms.rendering import FieldSet
1218
from utilities.forms.fields import CommentField, DynamicModelChoiceField
@@ -445,12 +451,37 @@ class ACLStandardRuleForm(NetBoxModelForm):
445451
),
446452
label="Access List",
447453
)
454+
448455
source_prefix = DynamicModelChoiceField(
449456
queryset=Prefix.objects.all(),
450457
required=False,
451458
help_text=help_text_acl_rule_logic,
452459
label="Source Prefix",
453460
)
461+
source_iprange = DynamicModelChoiceField(
462+
queryset=IPRange.objects.all(),
463+
required=False,
464+
help_text=help_text_acl_rule_logic,
465+
label="Source IP-Range",
466+
)
467+
source_ipaddress = DynamicModelChoiceField(
468+
queryset=IPAddress.objects.all(),
469+
required=False,
470+
help_text=help_text_acl_rule_logic,
471+
label="Source IP-Address",
472+
)
473+
source_aggregate = DynamicModelChoiceField(
474+
queryset=Aggregate.objects.all(),
475+
required=False,
476+
help_text=help_text_acl_rule_logic,
477+
label="Source Aggregate",
478+
)
479+
source_service = DynamicModelChoiceField(
480+
queryset=Service.objects.all(),
481+
required=False,
482+
help_text=help_text_acl_rule_logic,
483+
label="Source Service",
484+
)
454485

455486
fieldsets = (
456487
FieldSet("access_list", "description", "tags", name=_('Access List Details')),
@@ -463,7 +494,13 @@ class Meta:
463494
"index",
464495
"action",
465496
"remark",
497+
466498
"source_prefix",
499+
"source_iprange",
500+
"source_ipaddress",
501+
"source_aggregate",
502+
"source_service",
503+
467504
"tags",
468505
"description",
469506
)

0 commit comments

Comments
 (0)