Skip to content
Justice Tech School

GET and POST

request.method tells how the page was requested.

Example
def contact(request):
    if request.method == "POST":
        name = request.POST["name"]
        return HttpResponse(name)
    return HttpResponse("form")

Exercise

Check method.

request. == "POST"

Quiz Test

Where is form data on POST?

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