Skip to content

Commit 62dc456

Browse files
committed
move constants
1 parent fb15e3b commit 62dc456

File tree

2 files changed

+34
-22
lines changed

2 files changed

+34
-22
lines changed

netbox_acls/forms/constants.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
Constants for forms
3+
"""
4+
from django.utils.safestring import mark_safe
5+
6+
# Sets a standard mark_safe help_text value to be used by the various classes
7+
HELP_TEXT_ACL_RULE_LOGIC = mark_safe(
8+
"<b>*Note:</b> CANNOT be set if action is set to remark.",
9+
)
10+
# Sets a standard help_text value to be used by the various classes for acl action
11+
HELP_TEXT_ACL_ACTION = "Action the rule will take (remark, deny, or allow)."
12+
# Sets a standard help_text value to be used by the various classes for acl index
13+
HELP_TEXT_ACL_RULE_INDEX = (
14+
"Determines the order of the rule in the ACL processing. AKA Sequence Number."
15+
)
16+
17+
# Sets a standard error message for ACL rules with an action of remark, but no remark set.
18+
ERROR_MESSAGE_NO_REMARK = "Action is set to remark, you MUST add a remark."
19+
# Sets a standard error message for ACL rules with an action of remark, but no source_prefix is set.
20+
ERROR_MESSAGE_ACTION_REMARK_SOURCE_PREFIX_SET = (
21+
"Action is set to remark, Source Prefix CANNOT be set."
22+
)
23+
# Sets a standard error message for ACL rules with an action not set to remark, but no remark is set.
24+
ERROR_MESSAGE_REMARK_WITHOUT_ACTION_REMARK = (
25+
"CANNOT set remark unless action is set to remark."
26+
)

netbox_acls/forms/models.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
)
1919

2020
from ..choices import ACLTypeChoices
21+
from .constants import (
22+
ERROR_MESSAGE_ACTION_REMARK_SOURCE_PREFIX_SET,
23+
ERROR_MESSAGE_NO_REMARK,
24+
ERROR_MESSAGE_REMARK_WITHOUT_ACTION_REMARK,
25+
HELP_TEXT_ACL_ACTION,
26+
HELP_TEXT_ACL_RULE_INDEX,
27+
HELP_TEXT_ACL_RULE_LOGIC,
28+
)
2129
from ..models import (
2230
AccessList,
2331
ACLExtendedRule,
@@ -32,28 +40,6 @@
3240
"ACLExtendedRuleForm",
3341
)
3442

35-
# Sets a standard mark_safe help_text value to be used by the various classes
36-
HELP_TEXT_ACL_RULE_LOGIC = mark_safe(
37-
"<b>*Note:</b> CANNOT be set if action is set to remark.",
38-
)
39-
# Sets a standard help_text value to be used by the various classes for acl action
40-
HELP_TEXT_ACL_ACTION = "Action the rule will take (remark, deny, or allow)."
41-
# Sets a standard help_text value to be used by the various classes for acl index
42-
HELP_TEXT_ACL_RULE_INDEX = (
43-
"Determines the order of the rule in the ACL processing. AKA Sequence Number."
44-
)
45-
46-
# Sets a standard error message for ACL rules with an action of remark, but no remark set.
47-
ERROR_MESSAGE_NO_REMARK = "Action is set to remark, you MUST add a remark."
48-
# Sets a standard error message for ACL rules with an action of remark, but no source_prefix is set.
49-
ERROR_MESSAGE_ACTION_REMARK_SOURCE_PREFIX_SET = (
50-
"Action is set to remark, Source Prefix CANNOT be set."
51-
)
52-
# Sets a standard error message for ACL rules with an action not set to remark, but no remark is set.
53-
ERROR_MESSAGE_REMARK_WITHOUT_ACTION_REMARK = (
54-
"CANNOT set remark unless action is set to remark."
55-
)
56-
5743

5844
class AccessListForm(NetBoxModelForm):
5945
"""

0 commit comments

Comments
 (0)