We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc6f21d commit 0ec632eCopy full SHA for 0ec632e
netbox/dcim/migrations/0191_module_bay_rebuild.py
@@ -0,0 +1,26 @@
1
+from django.db import migrations
2
+import mptt
3
+import mptt.managers
4
+
5
6
+def rebuild_mptt(apps, schema_editor):
7
+ manager = mptt.managers.TreeManager()
8
+ ModuleBay = apps.get_model('dcim', 'ModuleBay')
9
+ manager.model = ModuleBay
10
+ mptt.register(ModuleBay)
11
+ manager.contribute_to_class(ModuleBay, 'objects')
12
+ manager.rebuild()
13
14
15
+class Migration(migrations.Migration):
16
17
+ dependencies = [
18
+ ('dcim', '0190_nested_modules'),
19
+ ]
20
21
+ operations = [
22
+ migrations.RunPython(
23
+ code=rebuild_mptt,
24
+ reverse_code=migrations.RunPython.noop
25
+ ),
26
0 commit comments