From 8e43e06ec21c652c90298f555681f0b8e39af283 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sun, 7 Jan 2024 11:54:38 +0800 Subject: [PATCH] Order by id available equipments --- equipment_tracker/equipments/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/equipment_tracker/equipments/views.py b/equipment_tracker/equipments/views.py index d1a03a7..e9f20d9 100644 --- a/equipment_tracker/equipments/views.py +++ b/equipment_tracker/equipments/views.py @@ -103,7 +103,8 @@ class AvailableEquipmentInstanceViewSet(generics.ListAPIView): # Get all equipment instances which are not associated with non-finalized transactions queryset = EquipmentInstance.objects.exclude( - id__in=non_finalized_equipments.values_list('id', flat=True) + id__in=non_finalized_equipments.values_list( + 'id', flat=True).order_by('id') ) cache.set(key, queryset, timeout=60*60*24)