-
Book Overview & Buying
-
Table Of Contents
Django 1.0 Template Development
There is no "magic number" or "correct" number of template files to have in your site. Every project's needs are different; some sites will have just a couple of templates, others may have dozens.
A good rule of thumb is that if you are repeating any part of your template on more than one or two pages, it's a good candidate to be put in its own file. This will save you time and effort down the line when you have to maintain these files by only having to make a change in one place.
With some planning, you can make your templates very flexible by creating blocks in your templates that you can use in child templates when the need arises.
One thing you'll probably want to do in your templates is create placeholders for JavaScript and CSS that can be supplied by your child templates.
When you define a block in a parent template, you are not required to use it in a child template. If you don't, the template engine will just return an empty block...
Change the font size
Change margin width
Change background colour