File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -543,16 +543,17 @@ class BaseACLRuleForm(NetBoxModelForm):
543
543
class Meta :
544
544
"""Defines the Model and fields to be used by the form."""
545
545
546
- model = ACLStandardRule
546
+ abstract = True
547
+ model = BaseACLRule
547
548
fields = (
548
549
"access_list" ,
549
550
"index" ,
550
551
"action" ,
551
552
"remark" ,
552
- "source_prefix" ,
553
553
"tags" ,
554
554
"description" ,
555
555
)
556
+ # Adds a help text to the form fields where the field is not defined in the form class.
556
557
help_texts = {
557
558
"action" : HELP_TEXT_ACL_ACTION ,
558
559
"destination_ports" : HELP_TEXT_ACL_RULE_LOGIC ,
@@ -617,6 +618,13 @@ class ACLStandardRuleForm(BaseACLRuleForm):
617
618
See the clean function for logic on other field requirements.
618
619
"""
619
620
621
+ class Meta (BaseACLRuleForm .Meta ):
622
+ """Defines the Model and fields to be used by the form."""
623
+
624
+ model = ACLStandardRule
625
+ # Need to add source_prefix to the tuple here instead of base or it will cause a ValueError
626
+ fields = BaseACLRuleForm .Meta .fields + ("source_prefix" ,)
627
+
620
628
621
629
class ACLExtendedRuleForm (BaseACLRuleForm ):
622
630
"""
@@ -648,20 +656,14 @@ class ACLExtendedRuleForm(BaseACLRuleForm):
648
656
),
649
657
)
650
658
651
- class Meta :
659
+ class Meta ( BaseACLRuleForm . Meta ) :
652
660
"""Defines the Model and fields to be used by the form."""
653
661
654
662
model = ACLExtendedRule
655
- fields = (
656
- "access_list" ,
657
- "index" ,
658
- "action" ,
659
- "remark" ,
663
+ fields = BaseACLRuleForm .Meta .fields + (
660
664
"source_prefix" ,
661
665
"source_ports" ,
662
666
"destination_prefix" ,
663
667
"destination_ports" ,
664
668
"protocol" ,
665
- "tags" ,
666
- "description" ,
667
669
)
You can’t perform that action at this time.
0 commit comments