Django Templates

It’s important to remember that Django’s templates are HTML files with a bit of extra code thrown in. And even saying that there is “code” in Django templates probably is exaggerating things a bit. The template syntax is designed explicitly to reduce the amount of code that you have to write, but also to reduce the amount of code that is executed in the template.

By removing code from the template and putting it into your view methods (and models), you make your application more modular, more flexible and more testable.