Practical Django Projects w. django-trunk

This and the following few posts will document the changes needed to work through the excellent book Practical Django Projects by James Bennett using django-trunk (revision 8290).

Figuring out the necessary changes is actually a quite good exercise in getting to know Django, but if you get stuck or feel lazy feel free to consult below:

Chapter 2 p. 13:

The lines to uncomment are:

# from django.contrib import admin
# admin.autodiscover()

and

# (r'^admin/(.*)', admin.site.root),

You might want to uncomment the following line too, which will activate the documentation in the admin site:

# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

Chapter 2 p. 15:

In addition to filling out the fields in the bulleted list you also need to select the “127.0.0.1:8000″ entry  in the “Sites” list at the bottom of the form as this field is required.

Chapter 3. p.23:

Make sure to add the (r’^… line before the (r”… line you added on p. 16. Otherwise the first “catch all” pattern will match your attempt to load the tiny_mce.js script and the script will fail to load.

Chapter 3. p34:

Leave out the following lines:

class Admin:
   pass

Instead do the following. In the search directory create a new fil admin.py with the followin contents:

from cms.search.models import SearchKeyword
from django.contrib.flatpages.models import FlatPage
from django.contrib import admin

class SearchKeywordInline(admin.StackedInline):
   model = SearchKeyword

class FlatPageAdmin(admin.ModelAdmin):
   inlines = [SearchKeywordInline,]

admin.site.register(SearchKeyword)
admin.site.unregister(FlatPage)
admin.site.register(FlatPage, FlatPageAdmin)

Chapter 3. p36:

Don’t add the core=True, edit_inline=models.STACKED, min_num_in_admin=3 and num_extra_on_change=1 options. The features added by these options are all handled by the admin.py file introduced above.


About this entry