UPDATE! Even better than listing out the individual errors, Phil Gyford has posted his working code for the examples in James Bennet’s “Practical Django Projects 2nd Edition“. You can find it on bitbucket here. Thanks Phil!
Chapter 4, page 66:
(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(P?<slug>[-\w]+)/$',
'coltrane.views.entry_detail'),
should be:
(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
'coltrane.views.entry_detail'),
(note the “P?” vs. “?P” before <slug>)
Chapter 4, page 70
Author should mention that the following must be added to the top of urls.py once you switch to generic views:
from coltrane.models import Entry
Chapter 4, page 71 and 73
Each of the four urlpatterns which include:
weblog/(?P<year>\d{4}/
Should actually be:
weblog/(?P<year>\d{4})/
(note the “)” after the {4})
No related posts.

5 Responses to “Errata: Practical Django Projects 2nd Edition (PDF)”
A big thank you for the error on the pattern on chapter 4 , page 66. Was struggling with that.
Just beginning Django , you saved me quite some time !!!
Christophe
Chapter 4 page 69:
(r’^weblog/(?P\d{4})/(?P\w{3})/(?P\d{2})/(?[-\w]+)/$,
‘django.views.generic.date_based.object_detail’, entry_info_dict)
should be
(r’^weblog/(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$,
‘django.views.generic.date_based.object_detail’, entry_info_dict)
Note the ?P instead of ?
for the slug group
Chapter 4, page 71
(r’^admin/’, include(admin.site_urls)),
should be
(r’^admin/’, include(admin.site.urls)),
Thank you so much for posting this up, I was pulling my hair over this and finally you solved it for me thank you again