Skip to content

Some typos #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions manuscript/chapter10-cookies.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ If you need more secure cookies, then use session based cookies.

1. Firstly, ensure that the `MIDDLEWARE_CLASSES` list in your Django project's `settings.py` module contains `django.contrib.sessions.middleware.SessionMiddleware`. If it doesn't, add it to the list.
2. Configure your session backend `SESSION_ENGINE`. See the [official Django Documentation on Sessions](https://docs.djangoproject.com/en/1.9/topics/http/sessions/) for the various backend configurations.
3. Check to see if the cookie exists via `requests.sessions.get()`.
4. Update or set the cookie via the session dictionary, `requests.session['<cookie_name>']`.
3. Check to see if the cookie exists via `request.session.get()`.
4. Update or set the cookie via the session dictionary, `request.session['<cookie_name>']`.

X> ### Exercises
X>
Expand All @@ -289,4 +289,4 @@ X>
X> - Check that your cookies are server side. Clear the browser's cache and cookies, then check to make sure you can't see the `last_visit` and `visits` variables in the browser. Note you will still see the `sessionid` cookie. Django uses this cookie to look up the session in the database where it stores all the server side cookies about that session.
X> - Update the *About* page view and template telling the visitors how many times they have visited the site. Remember to call the `visitor_cookie_handler()` before you attempt to get the `visits` cookie from the `request.session` dictionary, otherwise if the cookie is not set it will raise an error.

[^1]: The latest version of the HTTP standard HTTP 1.1 actually supports the ability for multiple requests to be sent in one TCP network connection. This provides huge improvements in performance, especially over high-latency network connections (such as via a traditional dial-up modem and satellite). This is referred to as *HTTP pipelining*, and you can read more about this technique on [Wikipedia](http://en.wikipedia.org/wiki/HTTP_pipelining).
[^1]: The latest version of the HTTP standard HTTP 1.1 actually supports the ability for multiple requests to be sent in one TCP network connection. This provides huge improvements in performance, especially over high-latency network connections (such as via a traditional dial-up modem and satellite). This is referred to as *HTTP pipelining*, and you can read more about this technique on [Wikipedia](http://en.wikipedia.org/wiki/HTTP_pipelining).
2 changes: 1 addition & 1 deletion manuscript/chapter18-ajax.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ To let users "like" certain categories, undertake the following workflow.

- In the `category.html` template:
- Add in a "Like" button with `id="like"`.
- Add in a template tag to display the number of likes: `{{% category.likes %}}`
- Add in a template tag to display the number of likes: `{{ category.likes }}`
- Place this inside a div with `id="like_count"`, i.e. `<div id="like_count">{{ category.likes }} </div>`
- This sets up the template to capture likes and to display likes for the category.
- Note, since the `category()` view passes a reference to the category object, we can use that to access the number of likes, with `{{ category.likes }}` in the template
Expand Down