PacktLib: Django 1.0 Template Development

Django 1.0 Template Development

Credits

About the Author

About the Reviewers

Preface

An Introduction to the Django Template System

What are templates?

Overview of the Django template system

Exploring how Django handles requests

Understanding the template system syntax

Creating our demo application

Summary

Views, URLs, and Generic Views

An overview

Creating the application

Mapping URLs to views

Creating views

Putting the views together

Comparing views and generic views

Summary

Template Context

The context explained

Using the context values in your templates

Context rendering shortcuts

Context processors

Summary

Using the Built-In Tags and Filters

Built-in filter reference

Built-in tag reference

Summary

Loading and Inheriting Templates

Configuring the template system

Finding a home for the template files

Working with the template loaders

Setting up the error handling templates

Breaking templates into reusable pieces

Extending templates with inheritance

Inheriting from multiple child templates

Appending to blocks

Template strategy

Using include files

Summary

Serving Multiple Templates

Considering the different approaches

Setting up our example

Serving printable pages

Creating site themes

Serving different templates by domain name

Redirecting users to the mobile site (optional)

Summary

Custom Tags and Filters

Examining the built-in tags and filters

Writing your own template filters

Writing your own template tags

Summary

Pagination

An Overview

Verifying our application setup

Exploring pagination using the Django shell

Using pagination in your views

Putting navigation into the templates

Pagination with generic views

Summary

Customizing the Admin Look and Feel

Overriding the admin templates

Customizing the admin header

Adding a new link box to the admin

Customizing the admin color scheme

Summary

Caching Your Pages

An overview

Exploring the available cache systems

Setting up your cache system

Caching individual views

Caching pieces of templates

Low-level caching

Caching your whole site

General caching strategies

Working with outside caches

Summary

Internationalization

Exploring i18n

Creating an example application

Configuring your project for i18n

Installing libraries for i18n translation

Marking strings as translatable

Creating message files

Enabling automatic language preference

Summary

Index