mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
mixin for full app functions
mainly migrations right now
This commit is contained in:
parent
b31c7ccd24
commit
0333b3fc72
@ -18,6 +18,7 @@ import random
|
|||||||
import string
|
import string
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
import pathlib
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import moneyed
|
import moneyed
|
||||||
@ -675,3 +676,7 @@ for plugin in inventree_plugins.load_integration_plugins():
|
|||||||
|
|
||||||
INTEGRATION_PLUGIN_SETTING[plugin_name] = plugin_setting
|
INTEGRATION_PLUGIN_SETTING[plugin_name] = plugin_setting
|
||||||
INTEGRATION_PLUGIN_SETTINGS.update(plugin_setting)
|
INTEGRATION_PLUGIN_SETTINGS.update(plugin_setting)
|
||||||
|
|
||||||
|
if plugin.mixin_enabled('app'):
|
||||||
|
plugin_path = '.'.join(pathlib.Path(plugin.path).relative_to(BASE_DIR).parts)
|
||||||
|
INSTALLED_APPS += [plugin_path]
|
||||||
|
@ -163,6 +163,25 @@ class NavigationMixin:
|
|||||||
does this plugin define navigation elements
|
does this plugin define navigation elements
|
||||||
"""
|
"""
|
||||||
return bool(self.navigation)
|
return bool(self.navigation)
|
||||||
|
|
||||||
|
|
||||||
|
class AppMixin:
|
||||||
|
"""Mixin that enables full django app functions for a plugin"""
|
||||||
|
class Meta:
|
||||||
|
"""meta options for this mixin"""
|
||||||
|
MIXIN_NAME = 'App registration'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.add_mixin('app', 'has_app', __class__)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def has_app(self):
|
||||||
|
"""
|
||||||
|
this plugin is always an app with this plugin
|
||||||
|
"""
|
||||||
|
return True
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user