Assorted fixes (#25)
* Updated imports for Netbox 3.6.1 Closes #21 and #23 * Changed Fieldtypes of Start and Expiration Date Closes #22 * Bump to NetBox v3.6.1 * Add pyproject.toml and python workflow --------- Co-authored-by: Manuel Hartung <manuel.hartung@atos.net>
This commit is contained in:
+26
-67
@@ -11,15 +11,10 @@ class SoftwareProductTable(NetBoxTable):
|
||||
|
||||
pk = ToggleColumn()
|
||||
name = tables.LinkColumn()
|
||||
manufacturer = tables.Column(
|
||||
accessor=Accessor('manufacturer'),
|
||||
linkify=True
|
||||
)
|
||||
installations = tables.Column(accessor='get_installation_count', verbose_name='Installations')
|
||||
manufacturer = tables.Column(accessor=Accessor("manufacturer"), linkify=True)
|
||||
installations = tables.Column(accessor="get_installation_count", verbose_name="Installations")
|
||||
|
||||
tags = columns.TagColumn(
|
||||
url_name="plugins:netbox_slm:softwareproduct_list",
|
||||
)
|
||||
tags = columns.TagColumn(url_name="plugins:netbox_slm:softwareproduct_list")
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = SoftwareProduct
|
||||
@@ -47,9 +42,9 @@ class SoftwareProductTable(NetBoxTable):
|
||||
)
|
||||
|
||||
def order_installations(self, queryset, is_descending):
|
||||
queryset = queryset.annotate(
|
||||
count=Count('softwareproductinstallation__id')
|
||||
).order_by(("-" if is_descending else "") + "count")
|
||||
queryset = queryset.annotate(count=Count("softwareproductinstallation__id")).order_by(
|
||||
("-" if is_descending else "") + "count"
|
||||
)
|
||||
return queryset, True
|
||||
|
||||
|
||||
@@ -57,20 +52,12 @@ class SoftwareProductVersionTable(NetBoxTable):
|
||||
"""Table for displaying SoftwareProductVersion objects."""
|
||||
|
||||
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
|
||||
)
|
||||
installations = tables.Column(accessor='get_installation_count', verbose_name='Installations')
|
||||
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)
|
||||
installations = tables.Column(accessor="get_installation_count", verbose_name="Installations")
|
||||
|
||||
tags = columns.TagColumn(
|
||||
url_name="plugins:netbox_slm:softwareproductversion_list",
|
||||
)
|
||||
tags = columns.TagColumn(url_name="plugins:netbox_slm:softwareproductversion_list")
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = SoftwareProductVersion
|
||||
@@ -98,9 +85,9 @@ class SoftwareProductVersionTable(NetBoxTable):
|
||||
)
|
||||
|
||||
def order_installations(self, queryset, is_descending):
|
||||
queryset = queryset.annotate(
|
||||
count=Count('softwareproductinstallation__id')
|
||||
).order_by(("-" if is_descending else "") + "count")
|
||||
queryset = queryset.annotate(count=Count("softwareproductinstallation__id")).order_by(
|
||||
("-" if is_descending else "") + "count"
|
||||
)
|
||||
return queryset, True
|
||||
|
||||
|
||||
@@ -109,31 +96,14 @@ 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
|
||||
)
|
||||
type = tables.Column(accessor='render_type')
|
||||
software_product = tables.Column(
|
||||
accessor=Accessor('software_product'),
|
||||
linkify=True
|
||||
)
|
||||
version = tables.Column(
|
||||
accessor=Accessor('version'),
|
||||
linkify=True
|
||||
)
|
||||
device = tables.Column(accessor=Accessor("device"), linkify=True)
|
||||
virtualmachine = tables.Column(accessor=Accessor("virtualmachine"), linkify=True)
|
||||
platform = tables.Column(accessor=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)
|
||||
|
||||
tags = columns.TagColumn(
|
||||
url_name="plugins:netbox_slm:softwareproductinstallation_list",
|
||||
)
|
||||
tags = columns.TagColumn(url_name="plugins:netbox_slm:softwareproductinstallation_list")
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = SoftwareProductInstallation
|
||||
@@ -173,23 +143,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(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)
|
||||
|
||||
tags = columns.TagColumn(
|
||||
url_name="plugins:netbox_slm:softwarelicense_list",
|
||||
)
|
||||
tags = columns.TagColumn(url_name="plugins:netbox_slm:softwarelicense_list")
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = SoftwareLicense
|
||||
|
||||
Reference in New Issue
Block a user