aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/models.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-11-19 13:54:49 -0600
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-11-19 13:54:49 -0600
commit5db324f7c60506cfb8124dc72ac8f408c341c0a0 (patch)
tree2a63f8f7d176be15a4b7af7cb1660240f203d975 /mediagoblin/db/models.py
parentb4b7b6a57a5ad9a5e52a5d3e05f9ad3d3e8b650a (diff)
parent1a3138addd43d410b03cdd1816e0a62bd217de30 (diff)
downloadmediagoblin-5db324f7c60506cfb8124dc72ac8f408c341c0a0.tar.lz
mediagoblin-5db324f7c60506cfb8124dc72ac8f408c341c0a0.tar.xz
mediagoblin-5db324f7c60506cfb8124dc72ac8f408c341c0a0.zip
Merge remote branch 'remotes/inconexo/441_comment_order'
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r--mediagoblin/db/models.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 1c1bc2fd..f13a4457 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -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):