Skip to content

Commit 231069d

Browse files
committed
feat(form): Adding new Sources to the ACLStandardRule creation form
1 parent 64554d1 commit 231069d

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.fields import CommentField, DynamicModelChoiceField
1218
from virtualization.models import (
@@ -432,12 +438,37 @@ class ACLStandardRuleForm(NetBoxModelForm):
432438
),
433439
label="Access List",
434440
)
441+
435442
source_prefix = DynamicModelChoiceField(
436443
queryset=Prefix.objects.all(),
437444
required=False,
438445
help_text=help_text_acl_rule_logic,
439446
label="Source Prefix",
440447
)
448+
source_iprange = DynamicModelChoiceField(
449+
queryset=IPRange.objects.all(),
450+
required=False,
451+
help_text=help_text_acl_rule_logic,
452+
label="Source IP-Range",
453+
)
454+
source_ipaddress = DynamicModelChoiceField(
455+
queryset=IPAddress.objects.all(),
456+
required=False,
457+
help_text=help_text_acl_rule_logic,
458+
label="Source IP-Address",
459+
)
460+
source_aggregate = DynamicModelChoiceField(
461+
queryset=Aggregate.objects.all(),
462+
required=False,
463+
help_text=help_text_acl_rule_logic,
464+
label="Source Aggregate",
465+
)
466+
source_service = DynamicModelChoiceField(
467+
queryset=Service.objects.all(),
468+
required=False,
469+
help_text=help_text_acl_rule_logic,
470+
label="Source Service",
471+
)
441472

442473
fieldsets = (
443474
("Access List Details", ("access_list", "description", "tags")),
@@ -451,7 +482,13 @@ class Meta:
451482
"index",
452483
"action",
453484
"remark",
485+
454486
"source_prefix",
487+
"source_iprange",
488+
"source_ipaddress",
489+
"source_aggregate",
490+
"source_service",
491+
455492
"tags",
456493
"description",
457494
)

0 commit comments

Comments
 (0)