def check(request): last_feed = request.GET.get('last_feed') feed_source = request.GET.get('feed_source') feeds = Feed.get_feeds_after(last_feed) if feed_source != 'all': feeds = feeds.filter(user__id=feed_source) count = feeds.count() return HttpResponse(count)
def _html_feeds(last_feed, user, csrf_token, feed_source='all'): feeds = Feed.get_feeds_after(last_feed) if feed_source != 'all': feeds = feeds.filter(user__id=feed_source) html = '' for feed in feeds: html = '{0}{1}'.format(html, render_to_string('feeds/partial_feed.html', { 'feed': feed, 'user': user, 'csrf_token': csrf_token })) return html