mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
use pluginreg to reload everywhere
This commit is contained in:
parent
4e6e87d950
commit
211a8e27e6
@ -5,7 +5,7 @@ from django.contrib import admin
|
|||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
|
|
||||||
import plugin.models as models
|
import plugin.models as models
|
||||||
|
from plugin import plugin_reg
|
||||||
|
|
||||||
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"""
|
||||||
@ -20,8 +20,7 @@ def plugin_update(queryset, new_status: bool):
|
|||||||
|
|
||||||
# reload plugins if they changed
|
# reload plugins if they changed
|
||||||
if apps_changed:
|
if apps_changed:
|
||||||
app = apps.get_app_config('plugin')
|
plugin_reg.reload_plugins()
|
||||||
app.reload_plugins()
|
|
||||||
|
|
||||||
|
|
||||||
@admin.action(description='Activate plugin(s)')
|
@admin.action(description='Activate plugin(s)')
|
||||||
|
@ -83,13 +83,12 @@ class PluginConfig(models.Model):
|
|||||||
reload = kwargs.pop('no_reload', False) # check if no_reload flag is set
|
reload = kwargs.pop('no_reload', False) # check if no_reload flag is set
|
||||||
|
|
||||||
ret = super().save(force_insert, force_update, *args, **kwargs)
|
ret = super().save(force_insert, force_update, *args, **kwargs)
|
||||||
app = apps.get_app_config('plugin')
|
|
||||||
|
|
||||||
if not reload:
|
if not reload:
|
||||||
if self.active is False and self.__org_active is True:
|
if self.active is False and self.__org_active is True:
|
||||||
app.reload_plugins()
|
plugin_reg.reload_plugins()
|
||||||
|
|
||||||
elif self.active is True and self.__org_active is False:
|
elif self.active is True and self.__org_active is False:
|
||||||
app.reload_plugins()
|
plugin_reg.reload_plugins()
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user