seperate choices from models

This commit is contained in:
ryanmerolle 2022-07-19 14:05:34 +00:00
parent 488768a55c
commit 596b4c8f39
2 changed files with 30 additions and 31 deletions

View File

@ -0,0 +1,29 @@
from utilities.choices import ChoiceSet
class ACLActionChoices(ChoiceSet):
ACTION_DENY = 'deny'
ACTION_PERMIT = 'permit'
ACTION_REJECT = 'reject'
CHOICES = [
(ACTION_DENY, 'Deny', 'red'),
(ACTION_PERMIT, 'Permit', 'green'),
(ACTION_REJECT, 'Reject (Reset)', 'orange'),
]
class ACLTypeChoices(ChoiceSet):
CHOICES = [
('extended', 'Extended', 'purple'),
('standard', 'Standard', 'blue'),
]
class ACLProtocolChoices(ChoiceSet):
CHOICES = [
('icmp', 'ICMP', 'purple'),
('tcp', 'TCP', 'blue'),
('udp', 'UDP', 'orange'),
]

View File

@ -3,37 +3,7 @@ from django.db import models
from django.urls import reverse
from netbox.models import NetBoxModel
from utilities.choices import ChoiceSet
class ACLActionChoices(ChoiceSet):
key = 'ACLExtendedRule.action'
ACTION_DENY = 'deny'
ACTION_PERMIT = 'permit'
ACTION_REJECT = 'reject'
CHOICES = [
(ACTION_DENY, 'Deny', 'red'),
(ACTION_PERMIT, 'Permit', 'green'),
(ACTION_REJECT, 'Reject (Reset)', 'orange'),
]
class ACLTypeChoices(ChoiceSet):
CHOICES = [
('extended', 'Extended', 'purple'),
('standard', 'Standard', 'blue'),
]
class ACLProtocolChoices(ChoiceSet):
CHOICES = [
('icmp', 'ICMP', 'purple'),
('tcp', 'TCP', 'blue'),
('udp', 'UDP', 'orange'),
]
from netbox_access_lists.choices import *
class AccessList(NetBoxModel):