Example code from James Bennett's Practical Django Projects (2nd ed.)