mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 10:58:37 -06:00
Adds L2VPN.status field, associated L2VPNStatusChoices, and migration
This commit is contained in:
parent
4e65117e7c
commit
2fb16f969e
@ -267,3 +267,17 @@ class L2VPNTypeChoices(ChoiceSet):
|
||||
TYPE_EPLAN,
|
||||
TYPE_EPTREE
|
||||
)
|
||||
|
||||
|
||||
class L2VPNStatusChoices(ChoiceSet):
|
||||
key = 'L2VPN.status'
|
||||
|
||||
STATUS_PLANNED = 'planned'
|
||||
STATUS_ACTIVE = 'active'
|
||||
STATUS_DECOMMISSIONED = 'decommissioned'
|
||||
|
||||
CHOICES = [
|
||||
(STATUS_PLANNED, _('Planned')),
|
||||
(STATUS_ACTIVE, _('Active')),
|
||||
(STATUS_DECOMMISSIONED, _('Decommissioned')),
|
||||
]
|
||||
|
16
netbox/vpn/migrations/0008_add_l2vpn_status.py
Normal file
16
netbox/vpn/migrations/0008_add_l2vpn_status.py
Normal file
@ -0,0 +1,16 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('vpn', '0007_natural_ordering'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='l2vpn',
|
||||
name='status',
|
||||
field=models.CharField(default='active', max_length=50),
|
||||
),
|
||||
]
|
@ -7,7 +7,7 @@ from django.utils.translation import gettext_lazy as _
|
||||
from core.models import ObjectType
|
||||
from netbox.models import NetBoxModel, PrimaryModel
|
||||
from netbox.models.features import ContactsMixin
|
||||
from vpn.choices import L2VPNTypeChoices
|
||||
from vpn.choices import L2VPNStatusChoices, L2VPNTypeChoices
|
||||
from vpn.constants import L2VPN_ASSIGNMENT_MODELS
|
||||
|
||||
__all__ = (
|
||||
@ -33,6 +33,12 @@ class L2VPN(ContactsMixin, PrimaryModel):
|
||||
max_length=50,
|
||||
choices=L2VPNTypeChoices
|
||||
)
|
||||
status = models.CharField(
|
||||
verbose_name=_('status'),
|
||||
max_length=50,
|
||||
choices=L2VPNStatusChoices,
|
||||
default=L2VPNStatusChoices.STATUS_ACTIVE,
|
||||
)
|
||||
identifier = models.BigIntegerField(
|
||||
verbose_name=_('identifier'),
|
||||
null=True,
|
||||
|
Loading…
Reference in New Issue
Block a user