def publicline(request): start = request.GET.get('start') tweets,next = riakapi.get_publicline(start=start, limit=NUM_PER_PAGE) context = { 'tweets': tweets, 'next': next, } return render_to_response('tweets/publicline.html', context, context_instance=RequestContext(request))
def timeline(request): form = TweetForm(request.POST or None) if request.user['is_authenticated'] and form.is_valid(): tweet_id = str(uuid.uuid1()) riakapi.save_tweet(tweet_id, request.session['username'], { 'username': request.session['username'], 'body': form.cleaned_data['body'], }) return HttpResponseRedirect(reverse('timeline')) start = request.GET.get('start') if request.user['is_authenticated']: tweets,next = riakapi.get_timeline(request.session['username'], start=start, limit=NUM_PER_PAGE) else: tweets,next = riakapi.get_publicline(start=start, limit=NUM_PER_PAGE) context = { 'form': form, 'tweets': tweets, 'next': next, } return render_to_response('tweets/timeline.html', context, context_instance=RequestContext(request))