mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-22 11:38:45 -06:00
fix migration
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
import mptt
|
|
||||||
import mptt.managers
|
|
||||||
|
|
||||||
|
|
||||||
def rebuild_mptt(apps, schema_editor):
|
def rebuild_mptt(apps, schema_editor):
|
||||||
@@ -8,12 +6,8 @@ def rebuild_mptt(apps, schema_editor):
|
|||||||
Rebuild the MPTT tree for ModuleBay to apply new ordering by 'name'
|
Rebuild the MPTT tree for ModuleBay to apply new ordering by 'name'
|
||||||
instead of 'module'.
|
instead of 'module'.
|
||||||
"""
|
"""
|
||||||
manager = mptt.managers.TreeManager()
|
|
||||||
ModuleBay = apps.get_model('dcim', 'ModuleBay')
|
ModuleBay = apps.get_model('dcim', 'ModuleBay')
|
||||||
manager.model = ModuleBay
|
ModuleBay.objects.rebuild()
|
||||||
mptt.register(ModuleBay)
|
|
||||||
manager.contribute_to_class(ModuleBay, 'objects')
|
|
||||||
manager.rebuild()
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|||||||
Reference in New Issue
Block a user