| | 10 | .. admonition:: Philosophy |
| | 11 | |
| | 12 | If you have a background in programming, or if you're used to |
| | 13 | languages like PHP which mix programming code directly into |
| | 14 | HTML, you'll want to bear in mind that the Django template system |
| | 15 | is not simply Python embedded into HTML. This is by design: the |
| | 16 | template system is meant to express presentation, not program |
| | 17 | logic. |
| | 18 | |
| | 19 | The Django template system does provide tags which function |
| | 20 | similarly to some programming constructs -- an ``{% if %}`` tag |
| | 21 | for boolean tests, a ``{% for %}`` tag for looping, etc. -- but |
| | 22 | these are not simply executed as the corresponding Python code, |
| | 23 | and the template system will not execute arbitrary Python |
| | 24 | expressions; only the tags, filters and syntax listed below are |
| | 25 | supported by default (though you can add `your own extensions`_ to |
| | 26 | the template language as needed). |
| | 27 | |