mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Replace unique_together with UniqueConstraints
This commit is contained in:
27
netbox/wireless/migrations/0006_unique_constraints.py
Normal file
27
netbox/wireless/migrations/0006_unique_constraints.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wireless', '0005_wirelesslink_interface_types'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterUniqueTogether(
|
||||
name='wirelesslangroup',
|
||||
unique_together=set(),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='wirelesslink',
|
||||
unique_together=set(),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='wirelesslangroup',
|
||||
constraint=models.UniqueConstraint(fields=('parent', 'name'), name='wireless_wirelesslangroup_unique_parent_name'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='wirelesslink',
|
||||
constraint=models.UniqueConstraint(fields=('interface_a', 'interface_b'), name='wireless_wirelesslink_unique_interfaces'),
|
||||
),
|
||||
]
|
@@ -69,8 +69,11 @@ class WirelessLANGroup(NestedGroupModel):
|
||||
|
||||
class Meta:
|
||||
ordering = ('name', 'pk')
|
||||
unique_together = (
|
||||
('parent', 'name')
|
||||
constraints = (
|
||||
models.UniqueConstraint(
|
||||
fields=('parent', 'name'),
|
||||
name='%(app_label)s_%(class)s_unique_parent_name'
|
||||
),
|
||||
)
|
||||
verbose_name = 'Wireless LAN Group'
|
||||
|
||||
@@ -195,7 +198,12 @@ class WirelessLink(WirelessAuthenticationBase, NetBoxModel):
|
||||
|
||||
class Meta:
|
||||
ordering = ['pk']
|
||||
unique_together = ('interface_a', 'interface_b')
|
||||
constraints = (
|
||||
models.UniqueConstraint(
|
||||
fields=('interface_a', 'interface_b'),
|
||||
name='%(app_label)s_%(class)s_unique_interfaces'
|
||||
),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f'#{self.pk}'
|
||||
|
Reference in New Issue
Block a user