mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-04 06:38:16 -06:00
17419 use get_model
This commit is contained in:
parent
0dd2a65007
commit
b44b12dce9
@ -1,9 +1,15 @@
|
|||||||
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):
|
||||||
from dcim.models import ModuleBay
|
manager = mptt.managers.TreeManager()
|
||||||
ModuleBay.objects.rebuild()
|
ModuleBay = apps.get_model('dcim', 'ModuleBay')
|
||||||
|
manager.model = ModuleBay
|
||||||
|
mptt.register(ModuleBay)
|
||||||
|
manager.contribute_to_class(ModuleBay, 'objects')
|
||||||
|
manager.rebuild()
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
Loading…
Reference in New Issue
Block a user