Adding a CMS to Your Flask Web App Transcripts
Chapter: The pages (our WordPress)
Lecture: Concept: Rendering pages

Login or purchase this course to watch this video and the rest of the course contents.
0:00 before we move on, let's quickly summarize our HTML ginger to template that we used to render the CMS pages and wow, are they simple? Look at this.
0:10 All we have to do is set the title. Remember our view Model passes over all of its fields, including the page and HTML, and the page has a title,
0:20 so we're going to set the title. That's the thing that shows up in the tab the official title that would be in
0:24 search or whatever. And then we're gonna have a block for our main content.
0:29 We're gonna add a padded CSS style or class so that we don't have everything just jammed up against the edges. And then he said again,
0:36 the each one of the page to the title as well. And then we have to just drop the HTML on the page, and we saw that we just dropped the HTML like curly,
0:46 curly HTML close. Girlies, it's going to try to protect us. Jinja to is going to say,
0:53 just to be safe, we want to make sure no one has written malicious HTML
0:57 are most likely JavaScript and submitted it in a way that could be shown back in like a forum or something, so we're going to encode that.
1:05 So we're sure that it's safe. But remember this HTML is not entered by users. It's entered by us, the people who run and create the website.
1:12 So we trust it and we want to actually put that HTML in the page as content. So we do pipe safe.
1:19 So one more time, just a warning safe means that this cannot be used for
1:23 you know, user generated content or you're just asking for somebody to cause problems It's definitely would be a security hole in that situation.
1:31 But because we trust the input, it's fine for us to do this and that's it. This is our template we used to render the page.


Talk Python's Mastodon Michael Kennedy's Mastodon