The HttpRequest Object
Read method, path, GET, and POST data.
Meet the Request Object
Django builds an HttpRequest for every visit and passes it to your view as the first argument, usually named request. 📨
def view(request):
return HttpResponse("ok")The HTTP Method
Check request.method to see how the page was asked for. It is a string like GET when reading or POST when submitting data.
if request.method == 'POST':
save_it()