Created
November 25, 2025 09:42
-
-
Save kevinhooke/5e03ce43f1f004a37a4f5a3a6763e841 to your computer and use it in GitHub Desktop.
Django view template notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% expression %} | |
| {{ output_value_in_context }} | |
| {% for item in items %} | |
| {{ item }} | |
| {% endfor %} | |
| {% if item %} | |
| output something | |
| {% else %} | |
| something else | |
| {% endif %} | |
| Conditional dislay: | |
| {{ value_in_context:default_if_none:"something else" }} | |
| Note no space between default_if_none:"something else" - if you add spaces you get error: | |
| "default_if_none requires 2 arguments, 1 provided" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment