mirror of
https://github.com/lemeow125/Borrowing-TrackerBackend.git
synced 2025-05-17 03:48:13 +08:00
Merge branch 'master' of https://git.keannu1.duckdns.org/keannu125/Borrowing-TrackerBackend
This commit is contained in:
commit
e8524e1d45
4 changed files with 20 additions and 5 deletions
|
@ -99,11 +99,12 @@ class AvailableEquipmentInstanceViewSet(generics.ListAPIView):
|
|||
# Get all equipment instances associated with non-finalized transactions
|
||||
non_finalized_equipments = EquipmentInstance.objects.filter(
|
||||
transaction__in=non_finalized_transactions
|
||||
).prefetch_related('equipment')
|
||||
).order_by('id').prefetch_related('equipment')
|
||||
|
||||
# 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)
|
||||
)
|
||||
cache.set(key, queryset, timeout=60*60*24)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue