The request in Django's views

Source: Internet
Author: User

Django uses the request and response objects to pass state between systems.

When a page is consulted, Django creates a HttpRequest object that contains the request metadata. Django then enters the appropriate view, passing HttpRequest as the first parameter to the view function. Each view is responsible for returning a HttpResponse object.

The properties of the HttpRequest instance contain most of the important information about this request. All attributes except the session should be considered read-only.

REQUEST

Created for convenience, this is a class Dictionary object that searches for POST before searching for GET . Inspired by PHP's $_reqeust .

For example, if GET = {"Name": "John"} , POST = {"Age": ' '} c5>, request["name" will be "John" , request["age" will be " a".

It is strongly recommended to use GET and POST instead of REQUEST . This is for forward compatibility and clearer representation.

The request in Django's views

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.