mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-02 05:46:25 -06:00
17419 use get_model
This commit is contained in:
parent
0dd2a65007
commit
b44b12dce9
@ -1,9 +1,15 @@
|
||||
from django.db import migrations
|
||||
import mptt
|
||||
import mptt.managers
|
||||
|
||||
|
||||
def rebuild_mptt(apps, schema_editor):
|
||||
from dcim.models import ModuleBay
|
||||
ModuleBay.objects.rebuild()
|
||||
manager = mptt.managers.TreeManager()
|
||||
ModuleBay = apps.get_model('dcim', 'ModuleBay')
|
||||
manager.model = ModuleBay
|
||||
mptt.register(ModuleBay)
|
||||
manager.contribute_to_class(ModuleBay, 'objects')
|
||||
manager.rebuild()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
Loading…
Reference in New Issue
Block a user