aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/user_pages/views.py
diff options
context:
space:
mode:
authorJef van Schendel <jefvanschendel@gmail.com>2011-06-17 23:11:20 +0200
committerJef van Schendel <jefvanschendel@gmail.com>2011-06-17 23:11:20 +0200
commitd81b39da4c0f67b5f1c02da31f2c671aaca39624 (patch)
treed098dbcf24c41c69f0fafe0910c1b8779a185751 /mediagoblin/user_pages/views.py
parentbb770e295cd727429df524b0a5c3952ea449fdb2 (diff)
parentd4ff1606c36b2243996b60657f374520d69cd1a3 (diff)
downloadmediagoblin-d81b39da4c0f67b5f1c02da31f2c671aaca39624.tar.lz
mediagoblin-d81b39da4c0f67b5f1c02da31f2c671aaca39624.tar.xz
mediagoblin-d81b39da4c0f67b5f1c02da31f2c671aaca39624.zip
Merge remote-tracking branch 'gitorious/master'
Diffstat (limited to 'mediagoblin/user_pages/views.py')
-rw-r--r--mediagoblin/user_pages/views.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 323c3e54..88b5dfe5 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -49,6 +49,33 @@ def user_home(request, page):
'media_entries': media_entries,
'pagination': pagination})
+@uses_pagination
+def user_gallery(request, page):
+ """'Gallery' of a User()"""
+ user = request.db.User.find_one({
+ 'username': request.matchdict['user'],
+ 'status': 'active'})
+ if not user:
+ return exc.HTTPNotFound()
+
+ cursor = request.db.MediaEntry.find(
+ {'uploader': user['_id'],
+ 'state': 'processed'}).sort('created', DESCENDING)
+
+ pagination = Pagination(page, cursor)
+ media_entries = pagination()
+
+ #if no data is available, return NotFound
+ if media_entries == None:
+ return exc.HTTPNotFound()
+
+ return render_to_response(
+ request,
+ 'mediagoblin/user_pages/gallery.html',
+ {'user': user,
+ 'media_entries': media_entries,
+ 'pagination': pagination})
+
@get_user_media_entry
def media_home(request, media):