Join Caleb Smith for an in-depth discussion in this video Introducing template tags, part of Learning Python and Django (2015).
- Templates are HTML files that have extra syntax.…When a view calls render, it passes data into the template,…and the template generates the HTML to show the user.…The syntax for Django templates has three pieces.…A variable's value is shown when the variable name is…used inside of double curly braces.…Template tag is enclosed in curly braces with…percent, and are used for for loops, ifs, structrual…elements, and some other things.…Lastly, a variable can have a pipe character…after it to use a template filter.…
Template filters take a string as input and return a string…as output, and can be thought of…much like the pipe in shell scripting.…These are mostly used to take a string and change…some formatting, such as date/time output formatting, or…just plain text in various cases, like title or uppercase.…As an example of using variables in a template,…let's assume we are editing the item_detail HTML template,…so a specific item has been passed into the template.…Here we have an h3 tag, and we use the double…
- Creating a new Django project
- Defining Django models and fields
- Querying data with the Django ORM
- Building views and templates
Skill Level Intermediate
Q: pip says it was installed correctly, and I've updated the PATH variable as shown, but the pip --version command isn't working. Why?
A: Depending on your computer's setup, you'll need to restart your terminal/command prompt before the additions you've made to the PATH variable are respected. With some setups, even that won't be enough, and you may need to restart the entire machine before you are able to use the pip command directly.