slug-style urls in previous and next urls look much better
authorCaleb Forbes Davis V <caldavis@gmail.com>
Wed, 6 Jul 2011 02:40:00 +0000 (21:40 -0500)
committerCaleb Forbes Davis V <caldavis@gmail.com>
Wed, 6 Jul 2011 02:40:00 +0000 (21:40 -0500)
Bug #434 - identifies media by slug instead of _id in prev/next

mediagoblin/db/models.py

index 8aa35ca9c59d8085f3d1ef46c71c0520718b491a..c7506dbba371274d53dff3c4814409937edc19da 100644 (file)
@@ -154,7 +154,7 @@ class MediaEntry(Document):
         if cursor.count():
             return urlgen('mediagoblin.user_pages.media_home',
                           user=self.uploader()['username'],
-                          media=unicode(cursor[0]['_id']))
+                          media=unicode(cursor[0]['slug']))
         
     def url_to_next(self, urlgen):
         """
@@ -167,7 +167,7 @@ class MediaEntry(Document):
         if cursor.count():
             return urlgen('mediagoblin.user_pages.media_home',
                           user=self.uploader()['username'],
-                          media=unicode(cursor[0]['_id']))
+                          media=unicode(cursor[0]['slug']))
 
     def uploader(self):
         return self.db.User.find_one({'_id': self['uploader']})