mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Update static files when installing or uninstalling a plugin
This commit is contained in:
parent
e4852b8b1b
commit
69057d98f7
@ -8,6 +8,7 @@ class Command(BaseCommand):
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
"""Run the management command."""
|
||||
from plugin.staticfiles import collect_plugins_static_files
|
||||
import plugin.staticfiles
|
||||
|
||||
collect_plugins_static_files()
|
||||
plugin.staticfiles.collect_plugins_static_files()
|
||||
plugin.staticfiles.clear_plugins_static_files()
|
||||
|
@ -269,6 +269,9 @@ def install_plugin(url=None, packagename=None, user=None, version=None):
|
||||
|
||||
registry.reload_plugins(full_reload=True, force_reload=True, collect=True)
|
||||
|
||||
# Update static files
|
||||
plugin.staticfiles.collect_plugins_static_files()
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
@ -333,6 +336,9 @@ def uninstall_plugin(cfg: plugin.models.PluginConfig, user=None, delete_config=T
|
||||
# Remove the plugin configuration from the database
|
||||
cfg.delete()
|
||||
|
||||
# Remove static files associated with this plugin
|
||||
plugin.staticfiles.clear_static_dir(f'plugins/{cfg.key}/', recursive=True)
|
||||
|
||||
# Reload the plugin registry
|
||||
registry.reload_plugins(full_reload=True, force_reload=True, collect=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user