mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
refactor to make simpler
This commit is contained in:
parent
21d187a387
commit
debad4ab9a
@ -22,9 +22,7 @@ class SettingsMixin:
|
||||
"""
|
||||
setup settings for this plugin
|
||||
"""
|
||||
if self.SETTINGS:
|
||||
return self.SETTINGS
|
||||
return None
|
||||
return getattr(self, 'SETTINGS', None)
|
||||
|
||||
@property
|
||||
def has_settings(self):
|
||||
@ -52,9 +50,7 @@ class UrlsMixin:
|
||||
"""
|
||||
setup url endpoints for this plugin
|
||||
"""
|
||||
if hasattr(self, 'URLS'):
|
||||
return self.URLS
|
||||
return None
|
||||
return getattr(self, 'URLS', None)
|
||||
|
||||
@property
|
||||
def base_url(self):
|
||||
@ -86,11 +82,9 @@ class IntegrationPlugin(plugin.InvenTreePlugin):
|
||||
self.add_mixin('base')
|
||||
super().__init__()
|
||||
|
||||
def add_mixin(self, key: str, fnc_enabled=None):
|
||||
def add_mixin(self, key: str, fnc_enabled=True):
|
||||
if not hasattr(self, 'mixins'):
|
||||
self.mixins = {}
|
||||
self.mixins[key] = True
|
||||
if fnc_enabled:
|
||||
self.mixins[key] = fnc_enabled
|
||||
|
||||
def module(self, key):
|
||||
|
Loading…
Reference in New Issue
Block a user