def bbs_thread(request, id): form = BbsCommentForm() thread = BbsThread.get_by_id(id) if request.method == 'POST': if form.validate(request.form): form.save(thread=thread) thread.put() return redirect('/bbs/%d' % id) return render_to_response('app/bbs/thread.html', {'form': form.as_widget(), 'thread': thread})
def bbs(request): form = BbsThreadForm() if request.method == 'POST': if form.validate(request.form): form.save() return redirect(url_for('app/bbs/index')) threads_all = BbsThread.all().order('-created') threads = create_paginator_page(request, threads_all) return render_to_response('app/bbs/index.html', {'form': form.as_widget(), 'threads': threads, 'paginator': render_paginator(threads)})