MCPcopy Create free account
hub / github.com/vercel/examples / note_create

Function note_create

python/django-notes/notes/views.py:14–24  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

12
13
14def note_create(request):
15 if settings.READ_ONLY:
16 return HttpResponseForbidden("This demo is read-only.")
17 if request.method == "POST":
18 form = NoteForm(request.POST)
19 if form.is_valid():
20 note = form.save()
21 return redirect("note_detail", pk=note.pk)
22 else:
23 form = NoteForm()
24 return render(request, "notes/form.html", {"form": form, "action": "Create"})
25
26
27def note_detail(request, pk):

Callers

nothing calls this directly

Calls 1

NoteFormClass · 0.85

Tested by

no test coverage detected