Tsallaka zuwa abun ciki
Justice Tech School

Using a Form in a View

Check is_valid then read cleaned_data.

Example
def contact(request):
    form = ContactForm(request.POST or None)
    if form.is_valid():
        print(form.cleaned_data["email"])
    return render(request, "contact.html", {"form": form})

Exercise

Validated data.

form.["name"]

Quiz Test

When is cleaned_data available?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.