From f3ba9fbbb848953017d5ea6be6de2604c5ae176e Mon Sep 17 00:00:00 2001
From: Olivier Mehani <shtrom+mediagoblin@ssji.net>
Date: Sat, 16 May 2020 23:42:39 +1000
Subject: [PATCH] Sort collections by date added
This makes the UX similar to tags, and other MG galleries in general.
Collection have the concept of a position, which collections were sorted
by before, but nothing apparently sets it or allows to modify it, which
means collections were, so far, sorted in natural DB order, rather than
something meaningful to the user
Signed-off-by: Olivier Mehani <shtrom+mediagoblin@ssji.net>
---
mediagoblin/db/models.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 0974676a..cb43193c 100644
a
|
b
|
class Collection(Base, CollectionMixin, CommentingMixin):
|
1197 | 1197 | |
1198 | 1198 | def get_collection_items(self, ascending=False): |
1199 | 1199 | #TODO, is this still needed with self.collection_items being available? |
1200 | | order_col = CollectionItem.position |
| 1200 | order_col = CollectionItem.added |
1201 | 1201 | if not ascending: |
1202 | 1202 | order_col = desc(order_col) |
1203 | 1203 | return CollectionItem.query.filter_by( |