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):
543543 class Meta :
544544 """Defines the Model and fields to be used by the form."""
545545
546- model = ACLStandardRule
546+ abstract = True
547+ model = BaseACLRule
547548 fields = (
548549 "access_list" ,
549550 "index" ,
550551 "action" ,
551552 "remark" ,
552- "source_prefix" ,
553553 "tags" ,
554554 "description" ,
555555 )
556+ # Adds a help text to the form fields where the field is not defined in the form class.
556557 help_texts = {
557558 "action" : HELP_TEXT_ACL_ACTION ,
558559 "destination_ports" : HELP_TEXT_ACL_RULE_LOGIC ,
@@ -617,6 +618,13 @@ class ACLStandardRuleForm(BaseACLRuleForm):
617618 See the clean function for logic on other field requirements.
618619 """
619620
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+
620628
621629class ACLExtendedRuleForm (BaseACLRuleForm ):
622630 """
@@ -648,20 +656,14 @@ class ACLExtendedRuleForm(BaseACLRuleForm):
648656 ),
649657 )
650658
651- class Meta :
659+ class Meta ( BaseACLRuleForm . Meta ) :
652660 """Defines the Model and fields to be used by the form."""
653661
654662 model = ACLExtendedRule
655- fields = (
656- "access_list" ,
657- "index" ,
658- "action" ,
659- "remark" ,
663+ fields = BaseACLRuleForm .Meta .fields + (
660664 "source_prefix" ,
661665 "source_ports" ,
662666 "destination_prefix" ,
663667 "destination_ports" ,
664668 "protocol" ,
665- "tags" ,
666- "description" ,
667669 )
You can’t perform that action at this time.
0 commit comments