mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-22 23:46:44 -06:00
Tweak ordering; add unique constraint
This commit is contained in:
parent
c7e3362408
commit
599d733df9
@ -1,4 +1,4 @@
|
|||||||
# Generated by Django 4.2.6 on 2023-11-07 21:49
|
# Generated by Django 4.2.7 on 2023-11-15 19:50
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
@ -11,10 +11,10 @@ class Migration(migrations.Migration):
|
|||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('tenancy', '0011_contactassignment_tags'),
|
|
||||||
('extras', '0099_cachedvalue_ordering'),
|
|
||||||
('contenttypes', '0002_remove_content_type_name'),
|
('contenttypes', '0002_remove_content_type_name'),
|
||||||
|
('tenancy', '0011_contactassignment_tags'),
|
||||||
('ipam', '0067_ipaddress_index_host'),
|
('ipam', '0067_ipaddress_index_host'),
|
||||||
|
('extras', '0099_cachedvalue_ordering'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@ -88,7 +88,11 @@ class Migration(migrations.Migration):
|
|||||||
options={
|
options={
|
||||||
'verbose_name': 'tunnel termination',
|
'verbose_name': 'tunnel termination',
|
||||||
'verbose_name_plural': 'tunnel terminations',
|
'verbose_name_plural': 'tunnel terminations',
|
||||||
'ordering': ('tunnel', 'pk'),
|
'ordering': ('tunnel', 'role', 'pk'),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='tunneltermination',
|
||||||
|
constraint=models.UniqueConstraint(fields=('interface_type', 'interface_id'), name='vpn_tunneltermination_interface', violation_error_message='An interface may be terminated to only one tunnel at a time.'),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@ -107,7 +107,14 @@ class TunnelTermination(CustomFieldsMixin, CustomLinksMixin, TagsMixin, ChangeLo
|
|||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('tunnel', 'pk')
|
ordering = ('tunnel', 'role', 'pk')
|
||||||
|
constraints = (
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=('interface_type', 'interface_id'),
|
||||||
|
name='%(app_label)s_%(class)s_interface',
|
||||||
|
violation_error_message=_("An interface may be terminated to only one tunnel at a time.")
|
||||||
|
),
|
||||||
|
)
|
||||||
verbose_name = _('tunnel termination')
|
verbose_name = _('tunnel termination')
|
||||||
verbose_name_plural = _('tunnel terminations')
|
verbose_name_plural = _('tunnel terminations')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user