2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 12:05:53 +00:00

author information for integration plugin

This commit is contained in:
Matthias
2021-10-04 19:54:20 +02:00
parent cec29310dc
commit 575be5b36a
2 changed files with 14 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import inspect
from django.conf.urls import url, include
from django.conf import settings
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
import plugins.plugin as plugin
@ -255,6 +256,8 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
"""
PLUGIN_SLUG = None
AUTHOR = None
def __init__(self):
super().__init__()
self.add_mixin('base')
@ -280,6 +283,16 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
name = self.plugin_name()
return name
@property
def author(self):
"""returns author of plugin - either from plugin settings or git"""
name = getattr(self, 'AUTHOR', None)
if not name:
name = self.commit.get('author')
if not name:
name = _('No author found')
return name
# mixins
def mixin(self, key):
"""check if mixin is registered"""