mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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
|
||||
|
||||
import plugin.models as models
|
||||
|
||||
from plugin import plugin_reg
|
||||
|
||||
def plugin_update(queryset, new_status: bool):
|
||||
"""general function for bulk changing plugins"""
|
||||
@ -20,8 +20,7 @@ def plugin_update(queryset, new_status: bool):
|
||||
|
||||
# reload plugins if they changed
|
||||
if apps_changed:
|
||||
app = apps.get_app_config('plugin')
|
||||
app.reload_plugins()
|
||||
plugin_reg.reload_plugins()
|
||||
|
||||
|
||||
@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
|
||||
|
||||
ret = super().save(force_insert, force_update, *args, **kwargs)
|
||||
app = apps.get_app_config('plugin')
|
||||
|
||||
if not reload:
|
||||
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:
|
||||
app.reload_plugins()
|
||||
plugin_reg.reload_plugins()
|
||||
|
||||
return ret
|
||||
|
Loading…
Reference in New Issue
Block a user