Django: Getting Started Transcripts
Chapter: Course conclusion
Lecture: Template engine

Login or purchase this course to watch this video and the rest of the course contents.
0:00 HTML can be quite repetitive across a website. You've got headers and footers that often appear on every page and stylistic pieces that might
0:08 be reused. To help you write less HTML, Django provides a templating mechanism that allows you to compose and reuse HTML
0:16 like you would with object oriented code, Django's template engine uses tags to denote different things that need to be done when rendering a template.
0:25 The extends tag works like inheritance and will insert the content between the block tags into a parent template.
0:32 There are also tags for doing conditional rendering, like in Python, there are four and if then else mechanisms allowing you to conditionally
0:40 or repeatedly include a chunk of HTML. To avoid hard coding URLs into your HTML the URL tag does a look up for a named URL.
0:49 URLs can be named when they are registered in a mapping file.
0:52 This means if you change your mind about a URL, you don't have to go hunting for it in all of your HTML.


Talk Python's Mastodon Michael Kennedy's Mastodon