mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 20:46:47 +00:00
unresgister models when deactivating
This commit is contained in:
parent
65ff226b90
commit
87edbf7c33
@ -207,6 +207,14 @@ class PluginAppConfig(AppConfig):
|
|||||||
return plugin_path
|
return plugin_path
|
||||||
|
|
||||||
def deactivate_integration_app(self):
|
def deactivate_integration_app(self):
|
||||||
|
# unregister models from admin
|
||||||
|
for app_name in settings.INTEGRATION_APPS_PATHS:
|
||||||
|
for model in apps.get_app_config(app_name.split('.')[-1]).get_models():
|
||||||
|
try:
|
||||||
|
admin.site.unregister(model)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# remove plugin from installed_apps
|
# remove plugin from installed_apps
|
||||||
for plugin in settings.INTEGRATION_APPS_PATHS:
|
for plugin in settings.INTEGRATION_APPS_PATHS:
|
||||||
settings.INSTALLED_APPS.remove(plugin)
|
settings.INSTALLED_APPS.remove(plugin)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user