18296 add tenant to vlan groups

This commit is contained in:
Arthur 2025-02-20 09:50:42 -08:00
parent 697610db94
commit 883113fa7d
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# Generated by Django 5.1.3 on 2025-02-20 17:49
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ipam', '0076_natural_ordering'),
('tenancy', '0017_natural_ordering'),
]
operations = [
migrations.AddField(
model_name='vlangroup',
name='tenant',
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name='vlan_groups',
to='tenancy.tenant',
),
),
]

View File

@ -65,6 +65,13 @@ class VLANGroup(OrganizationalModel):
_total_vlan_ids = models.PositiveBigIntegerField( _total_vlan_ids = models.PositiveBigIntegerField(
default=VLAN_VID_MAX - VLAN_VID_MIN + 1 default=VLAN_VID_MAX - VLAN_VID_MIN + 1
) )
tenant = models.ForeignKey(
to='tenancy.Tenant',
on_delete=models.PROTECT,
related_name='vlan_groups',
blank=True,
null=True
)
objects = VLANGroupQuerySet.as_manager() objects = VLANGroupQuerySet.as_manager()