From c92912ff03c228acc3af262e66da2f4281786872 Mon Sep 17 00:00:00 2001 From: Arthur Date: Wed, 21 Jan 2026 12:52:41 -0800 Subject: [PATCH] fix migration --- netbox/dcim/migrations/0226_modulebay_rebuild_tree.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/netbox/dcim/migrations/0226_modulebay_rebuild_tree.py b/netbox/dcim/migrations/0226_modulebay_rebuild_tree.py index 53f3cecff..2d3cf5b50 100644 --- a/netbox/dcim/migrations/0226_modulebay_rebuild_tree.py +++ b/netbox/dcim/migrations/0226_modulebay_rebuild_tree.py @@ -1,12 +1,11 @@ from django.db import migrations -import mptt import mptt.managers +import mptt.models def rebuild_mptt(apps, schema_editor): """ - Rebuild the MPTT tree for ModuleBay to apply new ordering by 'name' - instead of 'module'. + Rebuild the MPTT tree for ModuleBay to apply new ordering. """ ModuleBay = apps.get_model('dcim', 'ModuleBay') @@ -14,11 +13,10 @@ def rebuild_mptt(apps, schema_editor): class MPTTMeta: order_insertion_by = ('module', 'name',) - ModuleBay.MPTTMeta = MPTTMeta + ModuleBay._mptt_meta = mptt.models.MPTTOptions(MPTTMeta, ModuleBay) manager = mptt.managers.TreeManager() manager.model = ModuleBay - mptt.register(ModuleBay) manager.contribute_to_class(ModuleBay, 'objects') manager.rebuild()