"description" field for plugin

Fixes #2293
This commit is contained in:
Matthias 2021-11-12 00:09:05 +01:00
parent 65046df417
commit b2478b418a
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
3 changed files with 20 additions and 0 deletions

View File

@ -271,6 +271,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
PLUGIN_TITLE = None PLUGIN_TITLE = None
AUTHOR = None AUTHOR = None
DESCRIPTION = None
PUBLISH_DATE = None PUBLISH_DATE = None
VERSION = None VERSION = None
WEBSITE = None WEBSITE = None
@ -304,6 +305,14 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
name = self.plugin_name() name = self.plugin_name()
return name return name
@property
def description(self):
"""description of plugin"""
description = getattr(self, 'DESCRIPTION', None)
if not description:
description = self.plugin_name()
return description
@property @property
def author(self): def author(self):
"""returns author of plugin - either from plugin settings or git""" """returns author of plugin - either from plugin settings or git"""

View File

@ -163,6 +163,7 @@ class IntegrationPluginBaseTests(TestCase):
PLUGIN_TITLE = 'a titel' PLUGIN_TITLE = 'a titel'
PUBLISH_DATE = "1111-11-11" PUBLISH_DATE = "1111-11-11"
AUTHOR = 'AA BB' AUTHOR = 'AA BB'
DESCRIPTION = 'A description'
VERSION = '1.2.3a' VERSION = '1.2.3a'
WEBSITE = 'http://aa.bb/cc' WEBSITE = 'http://aa.bb/cc'
@ -185,6 +186,11 @@ class IntegrationPluginBaseTests(TestCase):
self.assertEqual(self.plugin_simple.human_name, 'SimplePlugin') self.assertEqual(self.plugin_simple.human_name, 'SimplePlugin')
self.assertEqual(self.plugin_name.human_name, 'a titel') self.assertEqual(self.plugin_name.human_name, 'a titel')
# description
self.assertEqual(self.plugin.description, '')
self.assertEqual(self.plugin_simple.description, 'SimplePlugin')
self.assertEqual(self.plugin_name.description, 'A description')
# author # author
self.assertEqual(self.plugin_name.author, 'AA BB') self.assertEqual(self.plugin_name.author, 'AA BB')

View File

@ -27,6 +27,11 @@
<td>{% trans "Author" %}</td> <td>{% trans "Author" %}</td>
<td>{{ plugin.author }}{% include "clip.html" %}</td> <td>{{ plugin.author }}{% include "clip.html" %}</td>
</tr> </tr>
<tr>
<td></td>
<td>{% trans "Description" %}</td>
<td>{{ plugin.description }}{% include "clip.html" %}</td>
</tr>
<tr> <tr>
<td><span class='fas fa-calendar-alt'></span></td> <td><span class='fas fa-calendar-alt'></span></td>
<td>{% trans "Date" %}</td> <td>{% trans "Date" %}</td>