def note_create(request): if "user" not in request.POST: return HttpResponseRedirect("/note/note_new/") else: form = NoteForm(request.POST) note = form.save() return HttpResponseRedirect("/note/note_detail/%d/" % (note.id))
def note_update(request): note_id = request.POST["note_id"] note = Note.objects.get(pk=note_id) form = NoteForm(request.POST, instance=note) note = form.save() return HttpResponseRedirect("/note/note_detail/%d/" % (note.id))