Merge remote branch 'remotes/inconexo/441_comment_order'
This commit is contained in:
commit
5db324f7c6
@ -217,9 +217,14 @@ class MediaEntry(Document):
|
||||
'created': datetime.datetime.utcnow,
|
||||
'state': u'unprocessed'}
|
||||
|
||||
def get_comments(self):
|
||||
def get_comments(self, ascending=False):
|
||||
if ascending:
|
||||
order = ASCENDING
|
||||
else:
|
||||
order = DESCENDING
|
||||
|
||||
return self.db.MediaComment.find({
|
||||
'media_entry': self._id}).sort('created', DESCENDING)
|
||||
'media_entry': self._id}).sort('created', order)
|
||||
|
||||
def get_display_media(self, media_map,
|
||||
fetch_order=common.DISPLAY_IMAGE_FETCHING_ORDER):
|
||||
|
@ -106,11 +106,11 @@ def media_home(request, media, page, **kwargs):
|
||||
"""
|
||||
if ObjectId(request.matchdict.get('comment')):
|
||||
pagination = Pagination(
|
||||
page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE,
|
||||
page, media.get_comments(True), MEDIA_COMMENTS_PER_PAGE,
|
||||
ObjectId(request.matchdict.get('comment')))
|
||||
else:
|
||||
pagination = Pagination(
|
||||
page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE)
|
||||
page, media.get_comments(True), MEDIA_COMMENTS_PER_PAGE)
|
||||
|
||||
comments = pagination()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user