From d6efa307593dda6b1a9258bc1b1a72f061f947d1 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Mon, 13 Nov 2023 18:02:05 +0800 Subject: [PATCH] Improved admin panel for equipment and equipment groups --- equipment_tracker/equipment_groups/admin.py | 2 +- equipment_tracker/equipments/admin.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/equipment_tracker/equipment_groups/admin.py b/equipment_tracker/equipment_groups/admin.py index da70e13..6d19b5a 100644 --- a/equipment_tracker/equipment_groups/admin.py +++ b/equipment_tracker/equipment_groups/admin.py @@ -5,5 +5,5 @@ from simple_history.admin import SimpleHistoryAdmin @admin.register(EquipmentGroup) class EquipmentGroupAdmin(SimpleHistoryAdmin): - readonly_fields = ('status',) + readonly_fields = ['status'] list_display = ('name', 'status', 'date_added', 'last_updated') diff --git a/equipment_tracker/equipments/admin.py b/equipment_tracker/equipments/admin.py index ae71d72..d099ead 100644 --- a/equipment_tracker/equipments/admin.py +++ b/equipment_tracker/equipments/admin.py @@ -2,5 +2,14 @@ from django.contrib import admin from simple_history.admin import SimpleHistoryAdmin from .models import Equipment, EquipmentInstance -admin.site.register(Equipment, SimpleHistoryAdmin) -admin.site.register(EquipmentInstance, SimpleHistoryAdmin) + +@admin.register(Equipment) +class EquipmentAdmin(SimpleHistoryAdmin): + readonly_fields = ('date_added', 'last_updated') + list_display = ('name', 'date_added', 'last_updated') + + +@admin.register(EquipmentInstance) +class EquipmentInstanceAdmin(SimpleHistoryAdmin): + list_display = ('equipment', 'status', 'remarks', + 'date_added', 'last_updated')