This commit is contained in:
Boris Bobrov 2014-06-20 08:03:29 +04:00
parent 4fcd2e756d
commit dbb86ffbbf

View File

@ -1134,11 +1134,11 @@ class Collection(Base, CollectionMixin, CommentingMixin):
def get_collection_items(self, ascending=False): def get_collection_items(self, ascending=False):
#TODO, is this still needed with self.collection_items being available? #TODO, is this still needed with self.collection_items being available?
order_col = CollectionItem.position order_col = MediaEntry.created
if not ascending: if not ascending:
order_col = desc(order_col) order_col = desc(order_col)
return CollectionItem.query.filter_by( return CollectionItem.query.join(MediaEntry).filter(
collection=self.id).order_by(order_col) CollectionItem.collection==self.id).order_by(order_col)
def __repr__(self): def __repr__(self):
safe_title = self.title.encode('ascii', 'replace') safe_title = self.title.encode('ascii', 'replace')