mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
Merge branch 'master' of https://github.com/inventree/InvenTree into plugin-app-refactor
This commit is contained in:
@ -106,7 +106,7 @@ class PluginConfig(models.Model):
|
||||
return ret
|
||||
|
||||
|
||||
class PluginSetting(common.models.GenericReferencedSettingClass, common.models.BaseInvenTreeSetting):
|
||||
class PluginSetting(common.models.BaseInvenTreeSetting):
|
||||
"""
|
||||
This model represents settings for individual plugins
|
||||
"""
|
||||
@ -116,7 +116,13 @@ class PluginSetting(common.models.GenericReferencedSettingClass, common.models.B
|
||||
('plugin', 'key'),
|
||||
]
|
||||
|
||||
REFERENCE_NAME = 'plugin'
|
||||
plugin = models.ForeignKey(
|
||||
PluginConfig,
|
||||
related_name='settings',
|
||||
null=False,
|
||||
verbose_name=_('Plugin'),
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_setting_definition(cls, key, **kwargs):
|
||||
@ -146,16 +152,18 @@ class PluginSetting(common.models.GenericReferencedSettingClass, common.models.B
|
||||
|
||||
return super().get_setting_definition(key, **kwargs)
|
||||
|
||||
plugin = models.ForeignKey(
|
||||
PluginConfig,
|
||||
related_name='settings',
|
||||
null=False,
|
||||
verbose_name=_('Plugin'),
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
def get_kwargs(self):
|
||||
"""
|
||||
Explicit kwargs required to uniquely identify a particular setting object,
|
||||
in addition to the 'key' parameter
|
||||
"""
|
||||
|
||||
return {
|
||||
'plugin': self.plugin,
|
||||
}
|
||||
|
||||
|
||||
class NotificationUserSetting(common.models.GenericReferencedSettingClass, common.models.BaseInvenTreeSetting):
|
||||
class NotificationUserSetting(common.models.BaseInvenTreeSetting):
|
||||
"""
|
||||
This model represents notification settings for a user
|
||||
"""
|
||||
@ -165,8 +173,6 @@ class NotificationUserSetting(common.models.GenericReferencedSettingClass, commo
|
||||
('method', 'user', 'key'),
|
||||
]
|
||||
|
||||
REFERENCE_NAME = 'method'
|
||||
|
||||
@classmethod
|
||||
def get_setting_definition(cls, key, **kwargs):
|
||||
from common.notifications import storage
|
||||
@ -175,6 +181,17 @@ class NotificationUserSetting(common.models.GenericReferencedSettingClass, commo
|
||||
|
||||
return super().get_setting_definition(key, **kwargs)
|
||||
|
||||
def get_kwargs(self):
|
||||
"""
|
||||
Explicit kwargs required to uniquely identify a particular setting object,
|
||||
in addition to the 'key' parameter
|
||||
"""
|
||||
|
||||
return {
|
||||
'method': self.method,
|
||||
'user': self.user,
|
||||
}
|
||||
|
||||
method = models.CharField(
|
||||
max_length=255,
|
||||
verbose_name=_('Method'),
|
||||
|
Reference in New Issue
Block a user