Adding a CMS to Your Flask Web App Transcripts
Chapter: Saving content to the DB
Lecture: Using pages from DB

Login or purchase this course to watch this video and the rest of the course contents.
0:00 now that we've made some changes to our CMS service for pages we've had toe pass more information to create a page,
0:07 and we've changed from using dictionaries to the page class itself. We gotta go on update where we're using this page right here.
0:14 You can see there's little warning from pie charm saying There's something missing you're gonna put
0:18 in the creating users So we'll just pass the email again of the logged in user like that. And then let's Joe check out the view models or at it Paige
0:29 and notice, because of the type ends we see right away. What's going on here, Right? There's issues. Page classes never get. But it does have a title,
0:38 you or l, and a content. That's good. Anything else? That one looks OK over here in this request view model. Let's go look and see right here.
0:54 We're doing dot content are we should be doing dot contents. All right. Ah, we may be in a place for this to work. Let's go and give it a shot.
1:04 All right, over here. Where? Our pages. Where did they go? Well, of course, we're no longer getting them from that fake data,
1:10 and now we're going to the database. But we haven't created one, so it's gonna be empty. Can we add one? So far,
1:16 so good. Let's just go and borrow the data out of our fake data here the most important one is the donate. So we'll come over here and say,
1:26 donate to the PSF, and it's just donate. And the contents are just this. Okay. Look at that. The pages now in the database we could edit it
1:39 may be yes. Yeah, that works. Now. Could we view it? Oh, yeah. So we go click on Donate. Now, this is coming out of her database.
1:51 Fantastic. Well, let's go and add the other two as well. We had our team. That was company slash employees.
1:59 Just put it back. So that worked like the rest. You know, the rest of the course what we've done so far,
2:05 It had these two pages. Let's just add them in here. Perfect. We got our team in company history.
2:22 All right. Does just check him out. Yeah, that one works, and that one works, and it looks just like you would expect.
2:28 And of course, donate. Bernie is working as well, so that's really good. We got our admin section of your pages,
2:35 our pages right there. And it looks like everything about them is working. And because we used a nice separation between the view models,
2:44 the admin views and the CMS service or services in general, we really only had two. Mostly mess with the service and then patch up the
2:52 view model real quick. Okay, so I think that that's pretty sweet. In order to celebrate, let's go and delete this.
3:00 That says you want to make sure you're not gonna crash something. Nope. We've already stopped using that. Now we deleted the fake data,
3:08 and let's just rerun it just to make sure that yeah, actually, we're not using it. We come over here, go to our admin pages.
3:16 Yes. There they are. We'll go to donate. Donate still there? Of course, this is now coming out of the database. There are many things in the database.
3:24 Before, we had 96 projects in 5400 releases 85 users, along with other things in there.
3:32 Right when you goto boto core like all of this was already in the database when it got started, but now are read Rex,
3:38 like going to visit the courses as well as the pages these air all now stored in seek welcoming our sequel Light through Sequel Alchemy.

Talk Python's Mastodon Michael Kennedy's Mastodon