mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
14438 fix migration
This commit is contained in:
parent
9543169025
commit
d162d440b0
@ -9,7 +9,7 @@ def update_scripts(apps, schema_editor):
|
|||||||
ScriptModuleNew = apps.get_model('extras', 'ScriptModule')
|
ScriptModuleNew = apps.get_model('extras', 'ScriptModule')
|
||||||
Script = apps.get_model('extras', 'Script')
|
Script = apps.get_model('extras', 'Script')
|
||||||
ContentType = apps.get_model('contenttypes', 'ContentType')
|
ContentType = apps.get_model('contenttypes', 'ContentType')
|
||||||
ct = ContentType.objects.get(app_label='extras', model='script')
|
ct = ContentType.objects.filter(app_label='extras', model='script').first()
|
||||||
|
|
||||||
for module in ScriptModule.objects.all():
|
for module in ScriptModule.objects.all():
|
||||||
for script in module.get_module_scripts.keys():
|
for script in module.get_module_scripts.keys():
|
||||||
@ -19,6 +19,7 @@ def update_scripts(apps, schema_editor):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# update all jobs associated with this module/name to point to the new script obj
|
# update all jobs associated with this module/name to point to the new script obj
|
||||||
|
if ct:
|
||||||
module.jobs.filter(name=script).update(object_type=ct, object_id=obj.id)
|
module.jobs.filter(name=script).update(object_type=ct, object_id=obj.id)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user