فهرست منبع

fix migration

Arthur 1 ماه پیش
والد
کامیت
6a5aced4bc
1فایلهای تغییر یافته به همراه1 افزوده شده و 7 حذف شده
  1. 1 7
      netbox/dcim/migrations/0226_modulebay_rebuild_tree.py

+ 1 - 7
netbox/dcim/migrations/0226_modulebay_rebuild_tree.py

@@ -1,6 +1,4 @@
 from django.db import migrations
-import mptt
-import mptt.managers
 
 
 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'
     instead of 'module'.
     """
-    manager = mptt.managers.TreeManager()
     ModuleBay = apps.get_model('dcim', 'ModuleBay')
-    manager.model = ModuleBay
-    mptt.register(ModuleBay)
-    manager.contribute_to_class(ModuleBay, 'objects')
-    manager.rebuild()
+    ModuleBay.objects.rebuild()
 
 
 class Migration(migrations.Migration):