Ejemplo n.º 1
0
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))
Ejemplo n.º 2
0
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))