Skip to content

Commit 69f19a1

Browse files
authored
fix: make event relationship order explicit (#17771)
Without a default order, some pages in Admin may display events in any order at all by traversing the relationship in a template, making it a little confusing as to what is most recent. Existing test `test_recent_events` uses `desc` order today, so preserve and make explicit. Signed-off-by: Mike Fiedler <[email protected]>
1 parent 25cc336 commit 69f19a1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

warehouse/events/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ def events(cls): # noqa: N805
198198
passive_deletes=True,
199199
lazy="dynamic",
200200
back_populates="source",
201+
order_by=f"desc({cls.__name__}Event.time)",
201202
)
202203

203204
def record_event(self, *, tag, request: Request, additional=None):

0 commit comments

Comments
 (0)