From c57393f45754b78e12901ed89536d8bb4ad62a3c Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 20 Nov 2021 03:05:01 +0100 Subject: [PATCH] refactor clean installed apps --- InvenTree/plugin/apps.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/InvenTree/plugin/apps.py b/InvenTree/plugin/apps.py index cd16de5291..6abb67a446 100644 --- a/InvenTree/plugin/apps.py +++ b/InvenTree/plugin/apps.py @@ -300,18 +300,22 @@ class PluginAppConfig(AppConfig): apps.all_models.pop(app_name) # remove plugin from installed_apps - for plugin in settings.INTEGRATION_APPS_PATHS: - if plugin in settings.INSTALLED_APPS: - settings.INSTALLED_APPS.remove(plugin) + self._clean_installed_apps() # reset load flag and reload apps - settings.INTEGRATION_APPS_PATHS = [] settings.INTEGRATION_APPS_LOADED = False self._reload_apps() # update urls to remove the apps from the site admin self._update_urls() + def _clean_installed_apps(self): + for plugin in settings.INTEGRATION_APPS_PATHS: + if plugin in settings.INSTALLED_APPS: + settings.INSTALLED_APPS.remove(plugin) + + settings.INTEGRATION_APPS_PATHS = [] + def _clean_registry(self): # remove all plugins from registry settings.INTEGRATION_PLUGINS = {}