fixed bug #728
authorBoris Bobrov <breton@cynicmansion.ru>
Fri, 20 Jun 2014 04:03:29 +0000 (08:03 +0400)
committerBoris Bobrov <breton@cynicmansion.ru>
Mon, 25 Jul 2016 01:13:04 +0000 (04:13 +0300)
mediagoblin/db/models.py

index 5393f6791d1ab33792c249ad47da739817d32568..b28e298aa5de8808ab3b1206bf51c84d30a95080 100644 (file)
@@ -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')