author information for integration plugin

This commit is contained in:
Matthias 2021-10-04 19:54:20 +02:00
parent cec29310dc
commit 575be5b36a
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
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.urls import url, include
from django.conf import settings from django.conf import settings
from django.utils.text import slugify from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
import plugins.plugin as plugin import plugins.plugin as plugin
@ -255,6 +256,8 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
""" """
PLUGIN_SLUG = None PLUGIN_SLUG = None
AUTHOR = None
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.add_mixin('base') self.add_mixin('base')
@ -280,6 +283,16 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
name = self.plugin_name() name = self.plugin_name()
return 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 # mixins
def mixin(self, key): def mixin(self, key):
"""check if mixin is registered""" """check if mixin is registered"""

View File

@ -46,7 +46,7 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</td> </td>
<td># TODO</td> <td>{{ plugin.author }}</td>
<td>{{plugin.commit.date}}</td> <td>{{plugin.commit.date}}</td>
</tr> </tr>
{% endfor %} {% endfor %}