def edit_entry(request, entry_id): data = _get_default_template_data(request) if not data['user']: return HttpResponseRedirect(users.create_login_url(request.path)) entry = Entry.get_by_id(long(entry_id)) if request.method == "POST": form = EntryForm(request.POST) if form.is_valid(): entry.title = form.cleaned_data['title'] entry.content = form.cleaned_data['content'] entry.put() return HttpResponseRedirect("/entry/%s/" % entry_id) else: form = EntryForm(initial={'title': entry.title, 'content': entry.content}) data['form'] = form data.update(csrf(request)) return render_to_response('edit.html', data)
def entry(request, entry_id): data = _get_default_template_data(request) data['entry'] = Entry.get_by_id(long(entry_id)) return render_to_response('entry.html', data)