def check(request): last_kpop = request.GET.get('last_kpop') kpop_source = request.GET.get('kpop_source') kpops = Kpop.get_kpops_after(last_kpop) if kpop_source != 'all': kpops = kpops.filter(user__id=kpop_source) count = kpops.count() return HttpResponse(count)
def _html_kpops(last_kpop, user, csrf_token, kpop_source='all'): kpops = Kpop.get_kpops_after(last_kpop) if kpop_source != 'all': kpops = kpops.filter(user__id=kpop_source) html = u'' for kpop in kpops: html = u'{0}{1}'.format(html, render_to_string('kpops/partial_kpop.html', { 'kpop': kpop, 'user': user, 'csrf_token': csrf_token }) ) return html