From f4188b957f261e0b28c1ccc55e1e73eeb4585a88 Mon Sep 17 00:00:00 2001 From: Hedde van der Heide Date: Mon, 28 Mar 2022 11:07:33 +0200 Subject: [PATCH] fixed 404 bug, added default ordering for some tables --- src/netbox_slm/models.py | 1 - src/netbox_slm/tables.py | 12 ++++++++++++ src/netbox_slm/views.py | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/netbox_slm/models.py b/src/netbox_slm/models.py index 941946b..87dbbb4 100644 --- a/src/netbox_slm/models.py +++ b/src/netbox_slm/models.py @@ -55,7 +55,6 @@ class SoftwareProductVersion(PrimaryModel): return reverse("plugins:netbox_slm:softwareproductversion", kwargs={"pk": self.pk}) def get_installation_count(self): - print("ACCESSED") count = SoftwareProductInstallation.objects.filter(version_id=self.pk).count() return safestring.mark_safe("{count}".format( url=reverse_lazy("plugins:netbox_slm:softwareproductinstallation_list") + f"?q={self.name}", diff --git a/src/netbox_slm/tables.py b/src/netbox_slm/tables.py index 379bf68..2fffa93 100644 --- a/src/netbox_slm/tables.py +++ b/src/netbox_slm/tables.py @@ -37,6 +37,12 @@ class SoftwareProductTable(BaseTable): "installations", # "tags", ) + sequence = ( + "manufacturer", + "name", + "description", + "installations", + ) class SoftwareProductVersionTable(BaseTable): @@ -76,6 +82,12 @@ class SoftwareProductVersionTable(BaseTable): "installations", # "tags", ) + sequence = ( + "manufacturer", + "software_product", + "name", + "installations", + ) class SoftwareProductInstallationTable(BaseTable): diff --git a/src/netbox_slm/views.py b/src/netbox_slm/views.py index 836e486..d8101c5 100644 --- a/src/netbox_slm/views.py +++ b/src/netbox_slm/views.py @@ -127,7 +127,7 @@ class SoftwareProductInstallationListView(generic.ObjectListView): class SoftwareProductInstallationView(generic.ObjectView): """Display SoftwareProductInstallation details""" - queryset = SoftwareProductVersion.objects.all() + queryset = SoftwareProductInstallation.objects.all() # def get_extra_context(self, request, instance): # records = instance.record_set.all()