def forum_comments(request): per_page = 25 comments = (db.Comment.objects_as(request.user) .select_related("article", "user", "user__userinfo") .order_by('-published'))[:per_page + 10] comments = db.mangle_comments( comments, request.user, request.META['REMOTE_ADDR']) return render_to_response( 'occupywallst/forum_comments.html', {'comments': comments[:per_page]}, context_instance=RequestContext(request))
def commentfeed(user, after, count, **kwargs): """Used for continuous stream of forum comments""" ip = _try_to_get_ip(kwargs) after, count = int(after), int(count) if after < 0 or count <= 0: raise APIException(_("bad arguments")) comments = (db.Comment.objects_as(user) .select_related("article", "user", "user__userinfo") .order_by('-published'))[after:after + count + 10] comments = db.mangle_comments(comments, user, ip) for comment in comments[:count]: yield render_to_string('occupywallst/comment.html', {'comment': comment, 'user': user, 'can_reply': True, 'extended': True})
def commentfeed(user, after, count, **kwargs): """Used for continuous stream of forum comments""" ip = _try_to_get_ip(kwargs) after, count = int(after), int(count) if after < 0 or count <= 0: raise APIException(_("bad arguments")) comments = (db.Comment.objects_as(user).select_related( "article", "user", "user__userinfo").order_by('-published'))[after:after + count + 10] comments = db.mangle_comments(comments, user, ip) for comment in comments[:count]: yield render_to_string('occupywallst/comment.html', { 'comment': comment, 'user': user, 'can_reply': True, 'extended': True })