mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
check if you the plugins really need to be reloaded
This commit is contained in:
parent
3b0a004d6e
commit
1794fb8865
@ -9,10 +9,17 @@ import plugin.models as models
|
|||||||
|
|
||||||
def plugin_update(queryset, new_status: bool):
|
def plugin_update(queryset, new_status: bool):
|
||||||
"""general function for bulk changing plugins"""
|
"""general function for bulk changing plugins"""
|
||||||
|
apps_changed = False
|
||||||
|
|
||||||
|
# run through all plugins in the queryset as the save method needs to be overridden
|
||||||
for model in queryset:
|
for model in queryset:
|
||||||
|
if model.active is not new_status:
|
||||||
model.active = new_status
|
model.active = new_status
|
||||||
|
apps_changed = True
|
||||||
model.save(no_reload=True)
|
model.save(no_reload=True)
|
||||||
|
|
||||||
|
# reload plugins if they changed
|
||||||
|
if apps_changed:
|
||||||
app = apps.get_app_config('plugin')
|
app = apps.get_app_config('plugin')
|
||||||
app.reload_plugins()
|
app.reload_plugins()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user