Revert "fixed bug #728"
authorBoris Bobrov <breton@cynicmansion.ru>
Tue, 16 Aug 2016 00:45:20 +0000 (03:45 +0300)
committerBoris Bobrov <breton@cynicmansion.ru>
Tue, 16 Aug 2016 00:45:20 +0000 (03:45 +0300)
This reverts commit dbb86ffbbf25651330266435752a6a0422cfb6e5.

It caused bug 5469

mediagoblin/db/models.py

index 0a20278fe1de08664f2ebc1428eea2e465aaecc8..f4644b9ff9281b804427012893bea3f225a44a8f 100644 (file)
@@ -1162,11 +1162,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 = MediaEntry.created
+        order_col = CollectionItem.position
         if not ascending:
             order_col = desc(order_col)
-        return CollectionItem.query.join(MediaEntry).filter(
-                CollectionItem.collection==self.id).order_by(order_col)
+        return CollectionItem.query.filter_by(
+            collection=self.id).order_by(order_col)
 
     def __repr__(self):
         safe_title = self.title.encode('ascii', 'replace')