Skip to content

Commit 87515f4

Browse files
committed
feat(form): ACLStandardRule: Instruct new Sources to be displayed as Tabbed Group; Improve Fieldsets
1 parent 7adb987 commit 87515f4

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

netbox_acls/forms/models.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
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 django.utils.translation import gettext_lazy as _
910
from ipam.models import (
1011
Prefix,
1112
IPRange,
@@ -23,7 +24,7 @@
2324
VirtualMachine,
2425
VMInterface,
2526
)
26-
27+
from utilities.forms.rendering import FieldSet, TabbedGroups
2728
from ..choices import ACLTypeChoices
2829
from ..models import (
2930
AccessList,
@@ -484,9 +485,31 @@ class ACLStandardRuleForm(NetBoxModelForm):
484485
)
485486

486487
fieldsets = (
487-
FieldSet("access_list", "description", "tags", name=_('Access List Details')),
488-
FieldSet("index", "action", "remark", "source_prefix", name=_('Rule Definition'))
488+
FieldSet(
489+
"access_list",
490+
"description",
491+
"tags",
492+
name=_('Access List Details')
493+
),
494+
FieldSet(
495+
"index",
496+
"action",
497+
"remark",
498+
name=_('Rule Definition')
499+
),
500+
FieldSet(
501+
TabbedGroups(
502+
FieldSet('source_prefix', name=_('Prefix')),
503+
FieldSet('source_iprange', name=_('IP Range')),
504+
FieldSet('source_ipaddress', name=_('IP Address')),
505+
FieldSet('source_aggregate', name=_('Aggregate')),
506+
FieldSet('source_service', name=_('Service')),
507+
)
508+
)
489509
)
510+
511+
512+
490513
class Meta:
491514
model = ACLStandardRule
492515
fields = (

0 commit comments

Comments
 (0)