mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	refactor clean installed apps
This commit is contained in:
		@@ -300,18 +300,22 @@ class PluginAppConfig(AppConfig):
 | 
				
			|||||||
                apps.all_models.pop(app_name)
 | 
					                apps.all_models.pop(app_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # remove plugin from installed_apps
 | 
					        # remove plugin from installed_apps
 | 
				
			||||||
        for plugin in settings.INTEGRATION_APPS_PATHS:
 | 
					        self._clean_installed_apps()
 | 
				
			||||||
            if plugin in settings.INSTALLED_APPS:
 | 
					 | 
				
			||||||
                settings.INSTALLED_APPS.remove(plugin)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # reset load flag and reload apps
 | 
					        # reset load flag and reload apps
 | 
				
			||||||
        settings.INTEGRATION_APPS_PATHS = []
 | 
					 | 
				
			||||||
        settings.INTEGRATION_APPS_LOADED = False
 | 
					        settings.INTEGRATION_APPS_LOADED = False
 | 
				
			||||||
        self._reload_apps()
 | 
					        self._reload_apps()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # update urls to remove the apps from the site admin
 | 
					        # update urls to remove the apps from the site admin
 | 
				
			||||||
        self._update_urls()
 | 
					        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):
 | 
					    def _clean_registry(self):
 | 
				
			||||||
        # remove all plugins from registry
 | 
					        # remove all plugins from registry
 | 
				
			||||||
        settings.INTEGRATION_PLUGINS = {}
 | 
					        settings.INTEGRATION_PLUGINS = {}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user