aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/user_pages
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2011-07-01 15:26:29 +0200
committerJoar Wandborg <git@wandborg.com>2011-07-01 15:26:29 +0200
commit6f59a3a32470b4d83ab94fe7c4dae83943500329 (patch)
tree3310a90ea298a8c1143035d878a34153d87270fe /mediagoblin/user_pages
parent40d18ad4c6d66d6db1aaf43df8d6ba23d162f77f (diff)
downloadmediagoblin-6f59a3a32470b4d83ab94fe7c4dae83943500329.tar.lz
mediagoblin-6f59a3a32470b4d83ab94fe7c4dae83943500329.tar.xz
mediagoblin-6f59a3a32470b4d83ab94fe7c4dae83943500329.zip
Issue #362 - Simple comments - Changes based on feedback recieved from #mediagoblin
* `db.models` - Removed `MediaEntry.get_comments()` and replaced it with a helper which just returns a cursor for the comments query * `media.html` - Added `{% set comment_author = comment.author() %}` * `user_pages.views` - media_home() now passes `MediaEntry.get_comments()` directly to `Pagination`, handles pagination for comments. * Added `MEDIA_COMMENTS_PER_PAGE` to define the number of comments per page in the `media_home()` view.
Diffstat (limited to 'mediagoblin/user_pages')
-rw-r--r--mediagoblin/user_pages/views.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 399d2020..012d27a3 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -82,17 +82,19 @@ def user_gallery(request, page):
'media_entries': media_entries,
'pagination': pagination})
+MEDIA_COMMENTS_PER_PAGE = 50
@get_user_media_entry
@uses_pagination
-def media_home(request, media, **kwargs):
+def media_home(request, media, page, **kwargs):
"""
'Homepage' of a MediaEntry()
"""
- comment_form = user_forms.MediaCommentForm(request.POST)
+ pagination = Pagination(page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE)
+ comments = pagination()
- (comments, pagination) = media.get_comments(kwargs.get('page'))
+ comment_form = user_forms.MediaCommentForm(request.POST)
return render_to_response(
request,