From: Boris Bobrov Date: Fri, 20 Jun 2014 04:03:29 +0000 (+0400) Subject: fixed bug #728 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dbb86ffbbf25651330266435752a6a0422cfb6e5;p=mediagoblin.git fixed bug #728 --- diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 5393f679..b28e298a 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -1134,11 +1134,11 @@ class Collection(Base, CollectionMixin, CommentingMixin): def get_collection_items(self, ascending=False): #TODO, is this still needed with self.collection_items being available? - order_col = CollectionItem.position + order_col = MediaEntry.created if not ascending: order_col = desc(order_col) - return CollectionItem.query.filter_by( - collection=self.id).order_by(order_col) + return CollectionItem.query.join(MediaEntry).filter( + CollectionItem.collection==self.id).order_by(order_col) def __repr__(self): safe_title = self.title.encode('ascii', 'replace')