Feature #423 - gallery and scroll image ordering match
[mediagoblin.git] / mediagoblin / db / models.py
index 8aa35ca9c59d8085f3d1ef46c71c0520718b491a..e764d3680bc38b8ca34eb6bd82dc24ee4a9107bb 100644 (file)
@@ -147,9 +147,9 @@ class MediaEntry(Document):
         """
         Provide a url to the previous entry from this user, if there is one
         """
-        cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']}, 
+        cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']}, 
                                           'uploader': self['uploader']}).sort(
-                                                    '_id', DESCENDING).limit(1)
+                                                    '_id', ASCENDING).limit(1)
                                                     
         if cursor.count():
             return urlgen('mediagoblin.user_pages.media_home',
@@ -160,9 +160,9 @@ class MediaEntry(Document):
         """
         Provide a url to the next entry from this user, if there is one
         """
-        cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']}, 
+        cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']}, 
                                           'uploader': self['uploader']}).sort(
-                                                    '_id', ASCENDING).limit(1)
+                                                    '_id', DESCENDING).limit(1)
 
         if cursor.count():
             return urlgen('mediagoblin.user_pages.media_home',