Skip to content

Commit 18ac680

Browse files
committed
feat(form): ACLStandardRule: Instruct new Sources to be displayed as Tabbed Group; Improve Fieldsets
1 parent 231069d commit 18ac680

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

netbox_acls/forms/models.py

Lines changed: 25 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,
@@ -22,7 +23,7 @@
2223
VirtualMachine,
2324
VMInterface,
2425
)
25-
26+
from utilities.forms.rendering import FieldSet, TabbedGroups
2627
from ..choices import ACLTypeChoices
2728
from ..models import (
2829
AccessList,
@@ -471,10 +472,31 @@ class ACLStandardRuleForm(NetBoxModelForm):
471472
)
472473

473474
fieldsets = (
474-
("Access List Details", ("access_list", "description", "tags")),
475-
("Rule Definition", ("index", "action", "remark", "source_prefix")),
475+
FieldSet(
476+
"access_list",
477+
"description",
478+
"tags",
479+
name=_('Access List Details')
480+
),
481+
FieldSet(
482+
"index",
483+
"action",
484+
"remark",
485+
name=_('Rule Definition')
486+
),
487+
FieldSet(
488+
TabbedGroups(
489+
FieldSet('source_prefix', name=_('Prefix')),
490+
FieldSet('source_iprange', name=_('IP Range')),
491+
FieldSet('source_ipaddress', name=_('IP Address')),
492+
FieldSet('source_aggregate', name=_('Aggregate')),
493+
FieldSet('source_service', name=_('Service')),
494+
)
495+
)
476496
)
477497

498+
499+
478500
class Meta:
479501
model = ACLStandardRule
480502
fields = (

0 commit comments

Comments
 (0)