Skip to content

Commit 8037c42

Browse files
Add node status to install list page (#831)
* Add node status to install list page * lint * Update src/meshapi/admin/models/install.py Co-authored-by: Andrew Dickinson <Andrew-Dickinson@users.noreply.github.com> --------- Co-authored-by: Andrew Dickinson <Andrew-Dickinson@users.noreply.github.com>
1 parent 9f72e15 commit 8037c42

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/meshapi/admin/models/install.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class InstallAdmin(RankedSearchMixin, ImportExportMixin, ExportActionMixin, Simp
5959
"install_date",
6060
"abandon_date",
6161
]
62-
list_display = ["__str__", "status", "node", "member", "building", "unit"]
62+
list_display = ["__str__", "status", "node", "get_node_status", "member", "building", "unit"]
6363
list_select_related = ["node", "member", "building"]
6464
search_fields = [
6565
# Install number
@@ -173,3 +173,11 @@ def get_search_results(
173173
except ValueError:
174174
pass
175175
return queryset, may_have_duplicates
176+
177+
def get_node_status(self, obj: Install) -> str:
178+
if not obj.node or not obj.node.status:
179+
return "-"
180+
return obj.node.status
181+
182+
get_node_status.short_description = "Node Status" # type: ignore[attr-defined]
183+
get_node_status.admin_order_field = "node__status" # type: ignore[attr-defined]

0 commit comments

Comments
 (0)