0
0
Djangoframework~5 mins

Process request and process response in Django - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a request in Django?
A request is an object that Django receives from a user’s browser. It contains all the information about what the user wants, like the URL, form data, and headers.
Click to reveal answer
beginner
What does Django use to send data back to the user?
Django sends a response object back to the user’s browser. This response contains the content to display, like HTML, JSON, or a redirect.
Click to reveal answer
intermediate
How does Django handle a request internally?
Django takes the request, matches its URL to a view function, runs that function, and then returns the response generated by the view.
Click to reveal answer
intermediate
What is the role of middleware in processing requests and responses?
Middleware is code that runs before and after the view. It can modify the request before it reaches the view or change the response before it goes back to the user.
Click to reveal answer
beginner
What is the difference between request.GET and request.POST?
request.GET holds data sent in the URL query string, usually from links or forms with method GET. request.POST holds data sent in the body of a POST request, usually from forms that submit data.
Click to reveal answer
What does Django use to decide which code runs for a request?
ADatabase schema
BURL routing
CTemplate engine
DMiddleware stack
Which object contains the data sent by the user in a form submission?
Arequest.GET
Bresponse.content
Crequest.POST
Drequest.META
What can middleware do in Django?
AModify both request and response
BOnly modify the response
COnly modify the request
DOnly handle database queries
What type of object does a Django view return?
ARequest object
BMiddleware object
CTemplate object
DResponse object
Where does Django store HTTP headers from the request?
Arequest.META
Brequest.headers
Crequest.POST
Dresponse.headers
Explain the journey of a user request through Django until a response is sent back.
Think about what happens from when you type a URL to when you see a page.
You got /5 concepts.
    Describe how you can access form data sent by a user in Django.
    Consider the HTTP methods and where data is stored in the request object.
    You got /4 concepts.