Building Data-Driven Web Apps with Flask and SQLAlchemy Transcripts
Chapter: Jinja2 templates
Lecture: Template chapter introduction

Login or purchase this course to watch this video and the rest of the course contents.
0:00 It's time to dig in to the HTML side of this whole web course. We're going to focus on templates and HTML and taking data and turning that into HTML.
0:11 As well as some patterns that make that very much nicer than maybe the most straightforward way. So, we're going to focus on templates
0:18 and these common views that share the layout and the overall look and feel across our site. Let's start with templates.
0:26 So, this is just a standalone example it's not from our PyPI project that we're working on. So, just to keep everything isolated.
0:33 And the goal is, if we're given a dictionary a list of dictionaries like this. So this is some form of data could have got it from the database
0:40 we could've gotten it from the web service hey, it can even come from a JSON file, who knows. But we have this data
0:46 we want to loop over those three items and we want to show a picture and we want to show the category.
0:53 This is from like a bike example, like a bike store and we have different categories of bikes each category has a picture of it
0:59 encourages people to click on it. And we're going to render this into some kind of responsive grid or set of divs or something to that effect.
1:07 It's going to look like this and have little picture and the title. Picture and the title, presumably they're going to be hyperlinks
1:13 something to that effect. We might not replicate this exactly 'cause we don't want to go too much into the design
1:19 but this is kind of what we're aiming for, okay? So we're going to see how we do that in Jinja


Talk Python's Mastodon Michael Kennedy's Mastodon