mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-25 02:41:43 +01:00
Upgrade django-mptt to 0.18.0 and add empty indexes tuple to MPTT model Meta classes. The empty tuple triggers Django's migration detection for indexes that django-mptt adds dynamically (see django-mptt/django-mptt#682). We cannot define the indexes explicitly because the MPTT fields don't exist when the Meta class is evaluated. Affected models: Region, SiteGroup, Location, DeviceRole, Platform, ModuleBay, InventoryItem, InventoryItemTemplate, TenantGroup, ContactGroup, WirelessLANGroup
This commit is contained in:
23
netbox/tenancy/migrations/0023_add_mptt_tree_indexes.py
Normal file
23
netbox/tenancy/migrations/0023_add_mptt_tree_indexes.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.2.10 on 2026-02-13 13:36
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('extras', '0134_owner'),
|
||||
('tenancy', '0022_add_comments_to_organizationalmodel'),
|
||||
('users', '0015_owner'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddIndex(
|
||||
model_name='contactgroup',
|
||||
index=models.Index(fields=['tree_id', 'lft'], name='tenancy_contactgroup_tree_d2ce'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='tenantgroup',
|
||||
index=models.Index(fields=['tree_id', 'lft'], name='tenancy_tenantgroup_tree_ifebc'),
|
||||
),
|
||||
]
|
||||
@@ -22,6 +22,9 @@ class ContactGroup(NestedGroupModel):
|
||||
"""
|
||||
class Meta:
|
||||
ordering = ['name']
|
||||
# Empty tuple triggers Django migration detection for MPTT indexes
|
||||
# (see #21016, django-mptt/django-mptt#682)
|
||||
indexes = ()
|
||||
constraints = (
|
||||
models.UniqueConstraint(
|
||||
fields=('parent', 'name'),
|
||||
|
||||
@@ -29,6 +29,9 @@ class TenantGroup(NestedGroupModel):
|
||||
|
||||
class Meta:
|
||||
ordering = ['name']
|
||||
# Empty tuple triggers Django migration detection for MPTT indexes
|
||||
# (see #21016, django-mptt/django-mptt#682)
|
||||
indexes = ()
|
||||
verbose_name = _('tenant group')
|
||||
verbose_name_plural = _('tenant groups')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user