mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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
|
||||
|
||||
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
|
||||
for plugin in settings.INTEGRATION_APPS_PATHS:
|
||||
settings.INSTALLED_APPS.remove(plugin)
|
||||
|
Loading…
Reference in New Issue
Block a user