diff --git a/netbox/core/tables/plugin.py b/netbox/core/tables/plugin.py index 4e0729a74..37c372a29 100644 --- a/netbox/core/tables/plugin.py +++ b/netbox/core/tables/plugin.py @@ -1,3 +1,5 @@ +from datetime import datetime +from django.contrib.humanize.templatetags.humanize import naturalday import django_tables2 as tables from django.utils.translation import gettext_lazy as _ from netbox.tables import BaseTable @@ -32,3 +34,6 @@ class CertifiedPluginTable(BaseTable): default_columns = ( 'version', 'last_updated', 'min_version', 'max_version', ) + + def render_last_updated(self, value, record): + return naturalday(datetime.fromisoformat(value)) diff --git a/netbox/core/views.py b/netbox/core/views.py index edced1af6..97279c1b5 100644 --- a/netbox/core/views.py +++ b/netbox/core/views.py @@ -39,6 +39,7 @@ from utilities.query import count_related from utilities.views import ContentTypePermissionRequiredMixin, GetRelatedModelsMixin, register_model_view from . import filtersets, forms, tables from .models import * +from .tables import CertifiedPluginTable # @@ -760,6 +761,11 @@ class PluginView(UserPassesTestMixin, View): plugins = get_catalog_plugins(plugins) plugin = plugins[name] + + table = CertifiedPluginTable(plugin['versions'], user=request.user) + table.configure(request) + return render(request, 'core/plugin.html', { 'plugin': plugin, + 'table': table, }) diff --git a/netbox/templates/core/plugin.html b/netbox/templates/core/plugin.html index 5d49521b1..a59605aed 100644 --- a/netbox/templates/core/plugin.html +++ b/netbox/templates/core/plugin.html @@ -53,32 +53,35 @@ From {{ plugin.description_short }}
- {{ plugin.versions }} +
+
+ {% include 'htmx/table.html' %} +
+

You can install this plugin from the command line with PyPi.

The following commands may be helpful; always refer to the plugin's own documentation and the Installing a Plugin unit of the NetBox documentation.

1. Enter the NetBox virtual environment and install the plugin package:

- - source /opt/netbox/venv/bin/activate
- pip install netbox-acls -
+ +

+source /opt/netbox/venv/bin/activate
+pip install netbox-acls
+    

2. In /opt/netbox/netbox/netbox/configuration.py, add the plugin to the PLUGINS list:

- -PLUGINS=[
-"netbox_acls',
+

+PLUGINS=[
+    "netbox_acls',
 ]
-    
+    

3. Still from the NetBox virtual environment, run database migrations and collect static files:

- -python3
-/opt/netbox/netbox/netbox/manage.py migrate
-pythons
-/opt/netbox/netbox/netbox/manage.py collectstatic -
+

+python3 /opt/netbox/netbox/netbox/manage.py migrate
+python3 /opt/netbox/netbox/netbox/manage.py collectstatic
+    

4. Restart the NetBox services to complete the plugin installation:

- +

 sudo systemctl restart netbox netbox-rq
-    
+    
{% endblock content %}