Ticket #728: 0001-Sort-collections-by-date-added.patch

File 0001-Sort-collections-by-date-added.patch, 1.2 KB (added by Olivier Mehani, 4 years ago)
  • mediagoblin/db/models.py

    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):  
    11981198    def get_collection_items(self, ascending=False):
    11991199        #TODO, is this still needed with self.collection_items being available?
    1200         order_col = CollectionItem.position
     1200        order_col = CollectionItem.added
    12011201        if not ascending:
    12021202            order_col = desc(order_col)
    12031203        return CollectionItem.query.filter_by(