#16388: Fix migration bug

This commit is contained in:
Jeremy Stretch 2024-06-17 08:36:03 -04:00
parent 853d990c03
commit e12edd7420

View File

@ -17,7 +17,7 @@ def update_dashboard_widgets(apps, schema_editor):
for dashboard in Dashboard.objects.all(): for dashboard in Dashboard.objects.all():
for key, widget in dashboard.config.items(): for key, widget in dashboard.config.items():
if getattr(widget['config'], 'model') == 'extras.objectchange': if widget['config'].get('model') == 'extras.objectchange':
widget['config']['model'] = 'core.objectchange' widget['config']['model'] = 'core.objectchange'
elif models := widget['config'].get('models'): elif models := widget['config'].get('models'):
models = list(map(lambda x: x.replace('extras.objectchange', 'core.objectchange'), models)) models = list(map(lambda x: x.replace('extras.objectchange', 'core.objectchange'), models))