mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improve docstrings
This commit is contained in:
parent
04820c894b
commit
be3bb05edd
@ -22,28 +22,30 @@ class GlobalSettingsMixin:
|
|||||||
|
|
||||||
def setup_globalsettings(self):
|
def setup_globalsettings(self):
|
||||||
"""
|
"""
|
||||||
setup global settings for this plugin
|
Setup global settings for this plugin
|
||||||
"""
|
"""
|
||||||
return getattr(self, 'SETTINGS', None)
|
return getattr(self, 'SETTINGS', None)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_globalsettings(self):
|
def has_globalsettings(self):
|
||||||
"""
|
"""
|
||||||
does this plugin use custom global settings
|
Does this plugin use custom global settings
|
||||||
"""
|
"""
|
||||||
return bool(self.globalsettings)
|
return bool(self.globalsettings)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def globalsettingspatterns(self):
|
def globalsettingspatterns(self):
|
||||||
"""
|
"""
|
||||||
get patterns for InvenTreeSetting defintion
|
Get patterns for InvenTreeSetting defintion
|
||||||
"""
|
"""
|
||||||
if self.has_globalsettings:
|
if self.has_globalsettings:
|
||||||
return {f'PLUGIN_{self.slug.upper()}_{key}': value for key, value in self.globalsettings.items()}
|
return {f'PLUGIN_{self.slug.upper()}_{key}': value for key, value in self.globalsettings.items()}
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _globalsetting_name(self, key):
|
def _globalsetting_name(self, key):
|
||||||
"""get global name of setting"""
|
"""
|
||||||
|
Get global name of setting
|
||||||
|
"""
|
||||||
return f'PLUGIN_{self.slug.upper()}_{key}'
|
return f'PLUGIN_{self.slug.upper()}_{key}'
|
||||||
|
|
||||||
def get_globalsetting(self, key):
|
def get_globalsetting(self, key):
|
||||||
@ -62,9 +64,11 @@ class GlobalSettingsMixin:
|
|||||||
|
|
||||||
|
|
||||||
class UrlsMixin:
|
class UrlsMixin:
|
||||||
"""Mixin that enables urls for the plugin"""
|
"""
|
||||||
|
Mixin that enables custom URLs for the plugin
|
||||||
|
"""
|
||||||
|
|
||||||
class MixinMeta:
|
class MixinMeta:
|
||||||
"""meta options for this mixin"""
|
|
||||||
MIXIN_NAME = 'URLs'
|
MIXIN_NAME = 'URLs'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -110,7 +114,10 @@ class UrlsMixin:
|
|||||||
|
|
||||||
|
|
||||||
class NavigationMixin:
|
class NavigationMixin:
|
||||||
"""Mixin that enables adding navigation links with the plugin"""
|
"""
|
||||||
|
Mixin that enables custom navigation links with the plugin
|
||||||
|
"""
|
||||||
|
|
||||||
NAVIGATION_TAB_NAME = None
|
NAVIGATION_TAB_NAME = None
|
||||||
NAVIGATION_TAB_ICON = "fas fa-question"
|
NAVIGATION_TAB_ICON = "fas fa-question"
|
||||||
|
|
||||||
@ -157,7 +164,10 @@ class NavigationMixin:
|
|||||||
|
|
||||||
|
|
||||||
class AppMixin:
|
class AppMixin:
|
||||||
"""Mixin that enables full django app functions for a plugin"""
|
"""
|
||||||
|
Mixin that enables full django app functions for a plugin
|
||||||
|
"""
|
||||||
|
|
||||||
class MixinMeta:
|
class MixinMeta:
|
||||||
"""meta options for this mixin"""
|
"""meta options for this mixin"""
|
||||||
MIXIN_NAME = 'App registration'
|
MIXIN_NAME = 'App registration'
|
||||||
|
Loading…
Reference in New Issue
Block a user