Errata
- 12 submitted: last submission 30 Mar 2017
Chapter 1,
Building a Blog Application | Section: Creating objects | Page no: 18 |Errata category: Code
The code given is:
>>> Post.objects.create(title='One more post',
slug='one-more-post',
body='Post body.',
author=user)
It should be as follows:
>>> post = Post(title='One more post',
slug='one-more-post',
body='Post body.',
author=user)
Chapter 2,
Enhancing Your Blog with Advanced Features | Section: Handling ModelForms in views | Page no:47 | Errata category: Technical
The sentence given is:
Edit the models.py file, add imports for the Comment model and the CommentForm form, and modify the post_detail view to make it look like the following:
It should be:
Edit the views.py file, add imports for the Comment model and the CommentForm form, and modify the post_detail view to make it look like the following:
Chapter 2,
Enhancing Your Blog with Advanced Features | Section: Adding comments to the post detail template | Page no: 49 | Errata category: Technical
The sentence given is:
Open the blog_detail.html template and append the following code inside the content block:
It should be:
Open the views_detail.html template and append the following code inside the content block:
Chapter 3:
Extending Your Blog Application | Section: Creating a search view | Page no: 83 | Errata category: Code
The code given is:
def post_search(request):
form = SearchForm()
if 'query' in request.GET:
form = SearchForm(request.GET)
if form.is_valid():
The code should be:
def post_search(request):
cd = None
form = SearchForm()
if 'query' in request.GET:
form = SearchForm(request.GET)
if form.is_valid():
Chapter 3:
Extending Your Blog Application | Section: Creating feeds for your blog posts | Page no: 74 | Errata category: typo
The sentence given is:
Navigate to http://127.0.0.1:8000/blog/feed/ in your browser. You should now see the RSS feedincluding the last five blog posts:
It should be:
Navigate to http://127.0.0.1:8000/blog/feed/ in your browser. You should now see the RSS feed including the last five blog posts:
Errata Type: Technical | Page 49 |
\1. The sentence given is: Now we need to adapt our post_detail.html template to do the following:
It should be: Now we need to adapt our post/detail.html template to do the following:
\2. The sentence given is: Open the blog_detail.html template and append the following code inside the content block:
It should be: Open the post/detail.html template and append the following code inside the content block:
\3. Errata for this mistakes on page https://www.packtpub.com/books/content/support/20895 has mistake Open the views_detail.html template and append the following code inside the content block:
It should be: Open the post/detail.html template and append the following code inside the content block:
On page 364 | Chapter 10 | Under section "Using mixins from django-braces"
Make OwnerCourseMixin inherit LoginRequiredMixin like this:
class OwnerCourseMixin(OwnerMixin, LoginRequiredMixin) :
Should be:
Make OwnerCourseEditMixin inherit LoginRequiredMixin like this:
class OwnerCourseEditMixin(OwnerMixin, LoginRequiredMixin) :
Chapter 1:
Extending Your Blog Application | Section: Using the filter() method | Page no: 18 | Errata category: code
The code given is:
Post.objects.filter(publish__year=2015)\
filter(author__username='admin')
It should be:
Post.objects.filter(publish__year=2015)\
.filter(author__username='admin')
Chapter 3:
Extending Your Blog Application | Section: Creating a search view | Page no: 84 | Errata category: typo
The sentence given is:
If the form is valid, we use the we use SearchQuerySet to perform a search for It should indexed Post objects whose main content contains the given query.
It should be:
If the form is valid, we use the SearchQuerySet to perform a search for It should indexed Post objects whose main content contains the given query.
Chapter 4:
Building a Social Website | Section: Log in and log out views | Page no: 100 | Errata category: code
The code given is:
Hello {{ request.user.first_name }},
It should be:
Hello {{ request.user.username }},
Chapter 3:
Extending Your Blog Application | Section: Creating custom template tags | Page no: 64-65 | Errata category: Typo
Our template tag will accept an optional count parameter that defaults to 5 and allows us to specify the number of comments we want to display.
The template tag we just created can be used passing the optional number of comments to display like {% show_latest_posts 3 %}.
Now, edit the blog/base.html template and add the new template tag to display the last 3 comments.
The template tag is called passing the number of comments to display and the template is rendered in place with the given context.
They should be:
Our template tag will accept an optional count parameter that defaults to 5 and allows us to specify the number of posts we want to display.
The template tag we just created can be used passing the optional number of posts to display like {% show_latest_posts 3 %}.
Now, edit the blog/base.html template and add the new template tag to display the last 3 posts.
The template tag is called passing the number of posts to display and the template is rendered in place with the given context.
Errata Type: Typo | Chapter 2 | Page 40
This:
request.build_absolute_uri
Should be:
request.build_absolute_url