We worked with template variables in the first chapter, but didn't discuss some of the subtleties of working with different kinds of data such as methods, objects, lists, and dictionaries. The template engine provides us with a simple way to work with different kinds of data by consistently using a dotted syntax. Regardless of the type of data you are trying to retrieve, you use the same syntax.
Let's look at some examples using the Django shell to keep things simple. We'll pass strings to the Template
object again to keep the examples clear, instead of loading the text from template files.
Note
Note: If you are not familiar with Python dictionaries, lists, objects, and methods, you'll probably want to brush up on these concepts before going any further. If you don't understand what you are putting into a template, you won't understand what you're getting back out.
A great reference is Mark Pilgrim's Dive Into Python, available for free at diveintopython...