def media_home(request, media, page, **kwargs): """ 'Homepage' of a MediaEntry() """ comment_id = request.matchdict.get('comment', None) if comment_id: if request.user: mark_comment_notification_seen(comment_id, request.user) pagination = Pagination( page, media.get_comments( mg_globals.app_config['comments_ascending']), MEDIA_COMMENTS_PER_PAGE, comment_id) else: pagination = Pagination( page, media.get_comments( mg_globals.app_config['comments_ascending']), MEDIA_COMMENTS_PER_PAGE) comments = pagination() comment_form = user_forms.MediaCommentForm(request.form) media_template_name = media.media_manager.display_template return render_to_response( request, media_template_name, {'media': media, 'comments': comments, 'pagination': pagination, 'comment_form': comment_form, 'app_config': mg_globals.app_config})
def media_home(request, media, **kwargs): """ 'Homepage' of a MediaEntry() """ comment_form = user_forms.MediaCommentForm(request.POST) (comments, pagination) = media.get_comments(kwargs.get('page')) return render_to_response( request, 'mediagoblin/user_pages/media.html', { 'media': media, 'comments': comments, 'pagination': pagination, 'comment_form': comment_form })
def media_home(request, media, page, **kwargs): """ 'Homepage' of a MediaEntry() """ comment_id = request.matchdict.get('comment', None) if comment_id: if request.user: mark_comment_notification_seen(comment_id, request.user) pagination = Pagination( page, media.get_comments( mg_globals.app_config['comments_ascending']), MEDIA_COMMENTS_PER_PAGE, comment_id) else: pagination = Pagination( page, media.get_comments( mg_globals.app_config['comments_ascending']), MEDIA_COMMENTS_PER_PAGE) comments = pagination() comment_form = user_forms.MediaCommentForm(request.form) media_template_name = media.media_manager.display_template context = { 'media': media, 'comments': comments, 'pagination': pagination, 'comment_form': comment_form, 'app_config': mg_globals.app_config} # Since the media template name gets swapped out for each media # type, normal context hooks don't work if you want to affect all # media displays. This gives a general purpose hook. context = hook_transform( "media_home_context", context) return render_to_response( request, media_template_name, context)