Add 'stored_location_url' to SoftwareLicense (#28)

Closes #27
This commit is contained in:
wkoot
2023-09-22 02:42:02 +02:00
committed by GitHub
parent aa41f8a402
commit 2501e41b7c
5 changed files with 60 additions and 15 deletions
+14 -13
View File
@@ -1,6 +1,5 @@
import django_tables2 as tables
from django.db.models import Count
from django_tables2.utils import Accessor
from netbox.tables import NetBoxTable, ToggleColumn, columns
from netbox_slm.models import SoftwareProduct, SoftwareProductVersion, SoftwareProductInstallation, SoftwareLicense
@@ -11,7 +10,7 @@ class SoftwareProductTable(NetBoxTable):
pk = ToggleColumn()
name = tables.LinkColumn()
manufacturer = tables.Column(accessor=Accessor("manufacturer"), linkify=True)
manufacturer = tables.Column(accessor="manufacturer", linkify=True)
installations = tables.Column(accessor="get_installation_count", verbose_name="Installations")
tags = columns.TagColumn(url_name="plugins:netbox_slm:softwareproduct_list")
@@ -53,8 +52,8 @@ class SoftwareProductVersionTable(NetBoxTable):
pk = ToggleColumn()
name = tables.LinkColumn(verbose_name="Version")
software_product = tables.Column(accessor=Accessor("software_product"), linkify=True)
manufacturer = tables.Column(accessor=Accessor("software_product__manufacturer"), linkify=True)
software_product = tables.Column(accessor="software_product", linkify=True)
manufacturer = tables.Column(accessor="software_product__manufacturer", linkify=True)
installations = tables.Column(accessor="get_installation_count", verbose_name="Installations")
tags = columns.TagColumn(url_name="plugins:netbox_slm:softwareproductversion_list")
@@ -96,12 +95,12 @@ class SoftwareProductInstallationTable(NetBoxTable):
pk = ToggleColumn()
name = tables.LinkColumn()
device = tables.Column(accessor=Accessor("device"), linkify=True)
virtualmachine = tables.Column(accessor=Accessor("virtualmachine"), linkify=True)
platform = tables.Column(accessor=Accessor("platform"), linkify=True)
device = tables.Column(accessor="device", linkify=True)
virtualmachine = tables.Column(accessor="virtualmachine", linkify=True)
platform = tables.Column(accessor="platform", linkify=True)
type = tables.Column(accessor="render_type")
software_product = tables.Column(accessor=Accessor("software_product"), linkify=True)
version = tables.Column(accessor=Accessor("version"), linkify=True)
software_product = tables.Column(accessor="software_product", linkify=True)
version = tables.Column(accessor="version", linkify=True)
tags = columns.TagColumn(url_name="plugins:netbox_slm:softwareproductinstallation_list")
@@ -143,10 +142,12 @@ class SoftwareLicenseTable(NetBoxTable):
pk = ToggleColumn()
name = tables.LinkColumn()
type = tables.Column(accessor="render_type")
software_product = tables.Column(accessor=Accessor("software_product"), linkify=True)
version = tables.Column(accessor=Accessor("version"), linkify=True)
installation = tables.Column(accessor=Accessor("installation"), linkify=True)
type = tables.Column()
stored_location = tables.Column(accessor="stored_location_txt", linkify=lambda record: record.stored_location_url)
software_product = tables.Column(accessor="software_product", linkify=True)
version = tables.Column(accessor="version", linkify=True)
installation = tables.Column(accessor="installation", linkify=True)
tags = columns.TagColumn(url_name="plugins:netbox_slm:softwarelicense_list")