From ef858f7701fd08042f415348f5d893903a9dab2b Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 4 Oct 2021 20:00:27 +0200 Subject: [PATCH] publishing date for integration plugins --- InvenTree/plugins/integration.py | 11 +++++++++++ InvenTree/templates/InvenTree/settings/plugin.html | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/InvenTree/plugins/integration.py b/InvenTree/plugins/integration.py index 76a5add70c..2177a4f610 100644 --- a/InvenTree/plugins/integration.py +++ b/InvenTree/plugins/integration.py @@ -257,6 +257,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin): PLUGIN_SLUG = None AUTHOR = None + PUBLISH_DATE = None def __init__(self): super().__init__() @@ -293,6 +294,16 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin): name = _('No author found') return name + @property + def pub_date(self): + """returns publishing date of plugin - either from plugin settings or git""" + name = getattr(self, 'PUBLISH_DATE', None) + if not name: + name = self.commit.get('date') + if not name: + name = _('No date found') + return name + # mixins def mixin(self, key): """check if mixin is registered""" diff --git a/InvenTree/templates/InvenTree/settings/plugin.html b/InvenTree/templates/InvenTree/settings/plugin.html index 2a14cb7fa0..c3109dda3c 100644 --- a/InvenTree/templates/InvenTree/settings/plugin.html +++ b/InvenTree/templates/InvenTree/settings/plugin.html @@ -47,7 +47,7 @@ {% endif %} {{ plugin.author }} - {{plugin.commit.date}} + {{ plugin.pub_date }} {% endfor %}