mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 10:58:37 -06:00
Use a TemplateColumn for is_installed
This commit is contained in:
parent
26bac97db2
commit
fdc879f00a
@ -2,6 +2,7 @@ import django_tables2 as tables
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from netbox.tables import BaseTable, columns
|
||||
from .template_code import PLUGIN_IS_INSTALLED
|
||||
|
||||
__all__ = (
|
||||
'CatalogPluginTable',
|
||||
@ -50,8 +51,9 @@ class CatalogPluginTable(BaseTable):
|
||||
is_local = columns.BooleanColumn(
|
||||
verbose_name=_('Local')
|
||||
)
|
||||
is_installed = columns.PluginActiveColumn(
|
||||
verbose_name=_('Active')
|
||||
is_installed = columns.TemplateColumn(
|
||||
verbose_name=_('Active'),
|
||||
template_code=PLUGIN_IS_INSTALLED
|
||||
)
|
||||
is_certified = columns.BooleanColumn(
|
||||
verbose_name=_('Certified')
|
||||
|
@ -14,3 +14,13 @@ OBJECTCHANGE_OBJECT = """
|
||||
OBJECTCHANGE_REQUEST_ID = """
|
||||
<a href="{% url 'core:objectchange_list' %}?request_id={{ value }}">{{ value }}</a>
|
||||
"""
|
||||
|
||||
PLUGIN_IS_INSTALLED = """
|
||||
{% if record.failed_to_load %}
|
||||
<span class="text-danger"><i class="mdi mdi-alert" data-bs-toggle="tooltip" title="Could not load due to NetBox version incompatibility. Min version: {{ record.netbox_min_version }}, max version: {{ record.netbox_max_version }}"></i></span>
|
||||
{% elif value is True %}
|
||||
<span class="text-success"><i class="mdi mdi-check-bold"></i></span>
|
||||
{% else %}
|
||||
<span class="text-danger"><i class="mdi mdi-close-thick"></i></span>
|
||||
{% endif %}
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user