adding in license meta

This commit is contained in:
Matthias 2021-11-12 00:12:03 +01:00
parent b2478b418a
commit 61f6061edf
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
3 changed files with 20 additions and 0 deletions

View File

@ -275,6 +275,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
PUBLISH_DATE = None PUBLISH_DATE = None
VERSION = None VERSION = None
WEBSITE = None WEBSITE = None
LICENSE = None
def __init__(self): def __init__(self):
super().__init__() super().__init__()
@ -347,6 +348,12 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
name = getattr(self, 'WEBSITE', None) name = getattr(self, 'WEBSITE', None)
return name return name
@property
def license(self):
"""returns license of plugin"""
license = getattr(self, 'LICENSE', None)
return license
@property @property
def package_path(self): def package_path(self):
"""returns the path to the plugin""" """returns the path to the plugin"""

View File

@ -166,6 +166,7 @@ class IntegrationPluginBaseTests(TestCase):
DESCRIPTION = 'A description' DESCRIPTION = 'A description'
VERSION = '1.2.3a' VERSION = '1.2.3a'
WEBSITE = 'http://aa.bb/cc' WEBSITE = 'http://aa.bb/cc'
LICENSE = 'MIT'
self.plugin_name = NameIntegrationPluginBase() self.plugin_name = NameIntegrationPluginBase()
@ -206,3 +207,8 @@ class IntegrationPluginBaseTests(TestCase):
self.assertEqual(self.plugin.website, None) self.assertEqual(self.plugin.website, None)
self.assertEqual(self.plugin_simple.website, None) self.assertEqual(self.plugin_simple.website, None)
self.assertEqual(self.plugin_name.website, 'http://aa.bb/cc') self.assertEqual(self.plugin_name.website, 'http://aa.bb/cc')
# license
self.assertEqual(self.plugin.license, None)
self.assertEqual(self.plugin_simple.license, None)
self.assertEqual(self.plugin_name.license, 'MIT')

View File

@ -55,6 +55,13 @@
<td>{{ plugin.website }}{% include "clip.html" %}</td> <td>{{ plugin.website }}{% include "clip.html" %}</td>
</tr> </tr>
{% endif %} {% endif %}
{% if plugin.license %}
<tr>
<td><span class='fas fa-balance-scale'></span></td>
<td>{% trans "License" %}</td>
<td>{{ plugin.license }}{% include "clip.html" %}</td>
</tr>
{% endif %}
</table> </table>
{% if plugin.is_package == False %} {% if plugin.is_package == False %}