mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-14 15:52:18 -06:00
* Enable E501 rule * Configure ruff formatter * Reformat migration files to fix line length violations * Fix various E501 errors * Move table template code to template_code.py & ignore E501 errors * Reformat raw SQL
23 lines
560 B
Python
23 lines
560 B
Python
from django.db import migrations
|
|
import mptt
|
|
import mptt.managers
|
|
|
|
|
|
def rebuild_mptt(apps, schema_editor):
|
|
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):
|
|
dependencies = [
|
|
('dcim', '0190_nested_modules'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(code=rebuild_mptt, reverse_code=migrations.RunPython.noop),
|
|
]
|