mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-12 19:39:35 -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
26 lines
884 B
Python
26 lines
884 B
Python
# Generated by Django 5.0.4 on 2024-04-24 20:09
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def update_dashboard_widgets(apps, schema_editor):
|
|
Dashboard = apps.get_model('extras', 'Dashboard')
|
|
|
|
for dashboard in Dashboard.objects.all():
|
|
for key, widget in dashboard.config.items():
|
|
if models := widget['config'].get('models'):
|
|
models = list(map(lambda x: x.replace('users.netboxgroup', 'users.group'), models))
|
|
models = list(map(lambda x: x.replace('users.netboxuser', 'users.user'), models))
|
|
dashboard.config[key]['config']['models'] = models
|
|
dashboard.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('extras', '0114_customfield_add_comments'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(code=update_dashboard_widgets, reverse_code=migrations.RunPython.noop),
|
|
]
|