[rentals] Use select_related in LockerInfo admin to improve load times

This commit is contained in:
Adam Goldsmith 2022-02-18 13:18:36 -05:00
parent 81377a8a87
commit 8b5489bc6f

View File

@ -30,3 +30,6 @@ class LockerInfoAdmin(admin.ModelAdmin):
list_filter = ["locker_unit__bank", "locker_unit", "renter"]
list_display = ["locker_unit", "address", "blind_code", "bitting_code", "renter"]
list_display_links = ["locker_unit", "address"]
def get_queryset(self, request):
return LockerInfo.objects.select_related("locker_unit", "locker_unit__bank")