Book Review: Django 1.0 Template Development

Published 27th July 2009

Django 1.0 Template Development Book Cover

The book is a comprehensive and practical guide of Django's template system aimed at beginners. Even though the author expects some experience with Django or Python I don’t think that’s necessarily the case. Knowledge about data structures like Python dictionaries is explained along the way and the template syntax is generally easy to understand. It should be noted though that the book doesn’t include an installation guide. A working development environment with Python and Django installed is required.

The writing style is clear and easily readable. There are also a lot of code examples to make things clear. Even though the 11 chapters are mostly structured around a follow-along example site it doesn’t need to be read sequentially. Especially the chapters at the end (Pagination, Internationalization, Cache) can also be read independently of the others.

With Django 1.1 around the corner a book about version 1.0 of the framework might seem a little outdated. But don’t worry, the API will remain stable until Django 2.0.

Content

The book starts out by explaining the syntax of the template system and illustrating how it fits into the big picture of handling requests in Django. The following two chapters then go into more detail about how URLs are mapped to views, views are structured and values are passed to the templates.

Chapter 4 is a reference of all built-in Tags and Filters. The author decided to include it because the online documentation didn’t provide examples of usage and syntax for all of them.

The next two chapters focus on template configuration, loading and inheritance. After an explanation of template loaders and the idea behind the extends- and block-tag the author goes on to show how alternative templates can be served by using template overrides and custom Middleware.

Finally, there are chapters on pagination, customizing the admin, caching and internationalization. Except for the, very detailed, pagination chapter the other don't go into as much depth as the online documentation but nonetheless provide a good overview of the basics. For example, the chapter about Internationalization only shows how strings in templates can be marked as translatable and message files can be generated. It still doesn’t go into as much depth as the online documentation about i18n.

Verdict

In my opinion, the book is missing a chapter about Forms. Most people dealing with templates in Django will at one point or another also want to work with Forms, so this would’ve been a good addition.

With that said, I’d recommend the book for web designers who are working with the template layer but have little or no experience with Django. It doesn’t go into much depth but covers enough topics to give the reader a good understanding of Django in general.