Workshop
The workshop consists of a set of questions and answers designed to solidify your understanding of the material covered in this hour. Try answering the questions before looking at the answers.
Quiz
1. | How do you test the browser to verify that it will accept cookies before allowing a web page to be displayed? |
2. | How do you access session data from a view function? |
3. | How can you request that the browser return only the sessionid cookie on an HTTPS connection? |
Quiz Answers
1. | Use the set_test_cookie() function to write a cookie to the browser. Then, in a subsequent request, use the test_cookie_worked() function to verify that the cookie was written. |
2. | Access the session attribute in the HttpRequest object passed to the view function. |
3. | Set the SESSION_COOKIE_SECURE setting to True in the settings.py file. |