« Back to Material for Readers

There are some small errors in our book that we think readers may want to know about. Any code errors listed here have been corrected in the source code downloads.

If you find anything else, please let us know!

Chapter 2

Page 66, first code sample: The correct code for Django 1.0 is slightly different. Specifically, you will want to uncomment lines 2, 3 and 14 (and probably 11 as well) in the generated, so it looks like this:

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

urlpatterns = patterns('',
    # Example:
    # (r'^mysite/', include('')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:

Chapter 4

Page 101, second code sample: Everything below class Meta should be indented one more stop (four spaces).

Chapter 5

Page 126, first sentence of third paragraph: HttpRequest should be HttpResponse.

Chapter 8

Page 189, 2nd sentence of 3rd paragraph after "Controlling Which Stories Are Viewed" header: says "Custom Managers" section is in Chapter 4. This is incorrect: custom managers are covered in Chapter 11 instead.

Page 192, second code sample: The "cms-search" urlpattern needs to occur before the "cms-story" urlpattern, or else search is never reached.

Page 199, code sample: there should be a Q where the line-wrap marker is printed.

Chapter 9

Page 217, Javascript code sample, second-to-last line: remove the double-quote after "update" (but keep the space and the single quote).

Chapter 10

Page 222, code sample: In the definition of the timestamp field, replace with auto_now_add=True.

Page 224, before form code: Explanation for "seeming redundancy in the path name" was omitted. In short, the reason is: the pastebin app uses generic views that expect certain template naming conventions (they want to find the templates in a directory on our template search path that's named after the app).