Parcourir la source

Order loans in member admin to display running loans first

Jocelyn Delalande il y a 7 ans
Parent
commit
878aa4fbd6
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  1. 4 0
      hardware_provisioning/admin.py

+ 4 - 0
hardware_provisioning/admin.py

@@ -155,6 +155,10 @@ class LoanInline(admin.TabularInline):
 
     show_change_link = True
 
+    def get_queryset(self, request):
+        qs = super(LoanInline, self).get_queryset(request)
+        return qs.order_by('-loan_date_end')
+
     def has_add_permission(self, request, obj=None):
         return False