mirror of
https://github.com/lucaspalomodevelop/netbox-acls.git
synced 2026-03-12 23:27:23 +00:00
seperate choices from models
This commit is contained in:
parent
488768a55c
commit
596b4c8f39
29
netbox_access_lists/choices.py
Normal file
29
netbox_access_lists/choices.py
Normal 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'),
|
||||
]
|
||||
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user