Exemple #1
0
def check(request):
    last_twit = request.GET.get('last_twit')
    twit_source = request.GET.get('twit_source')
    twits = Twit.get_twits_after(last_twit)
    if twit_source != 'all':
        twits = twits.filter(user__id=twit_source)
    count = twits.count()
    return HttpResponse(count)
Exemple #2
0
def _html_twits(last_twit, user, csrf_token, twit_source='all'):
    twits = Twit.get_twits_after(last_twit)
    if twit_source != 'all':
        twits = twits.filter(user__id=twit_source)
    html = u''
    for twit in twits:
        html = u'{0}{1}'.format(html, render_to_string('twits/partial_twit.html', {
            'twit': twit,
            'user': user,
            'csrf_token': csrf_token
            })
        )
    return html