refactor clean installed apps

This commit is contained in:
Matthias 2021-11-20 03:05:01 +01:00
parent ad98c1df48
commit c57393f457
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -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 = {}