From 9e73f23f0de3408081cd697419a3314ff1f79153 Mon Sep 17 00:00:00 2001 From: msj Date: Fri, 14 Jun 2024 10:28:27 -0400 Subject: [PATCH] Don't move order by --- lametro/models.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lametro/models.py b/lametro/models.py index 08450ba6..3f1a8006 100644 --- a/lametro/models.py +++ b/lametro/models.py @@ -418,20 +418,17 @@ def committee_sponsorships(self): Organizations do not include the Board of Directors. """ - actions = ( - BillAction.objects.select_related("organization") - .filter( - organization__classification="committee", - organization__memberships__in=Subquery( - self.current_memberships.values("pk") - ), - ) - .order_by("-date") + actions = BillAction.objects.select_related("organization").filter( + organization__classification="committee", + organization__memberships__in=Subquery( + self.current_memberships.values("pk") + ), ) qs = ( LAMetroBill.objects.defer("extras") .filter(actions__in=Subquery(actions.values("pk"))) + .order_by("-actions__date") .distinct()[:5] )