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

Login or purchase this course to watch this video and the rest of the course contents.
0:00 with the CMS service updated in the view models in place, we might be able to just have this work not 100% sure about that. But let's give it a try.
0:09 So in a way, those pages go to admin. All right? I've tried this view pages, Nothing broke. Let's add a page.
0:17 Now, I'm gonna go borrow some of this from our fake data that we had appear One of them waas donate.
0:26 We had donate and donate to the PSF when we had those contents. So it's this one's gonna be just donate.
0:32 And we had these contents we wanted to put in there. So let's put him in there. See what we get repaid. Fingers crossed. No. What do we miss?
0:42 Creating user not passed along just like we had before. So no problem. Let's do that really quick.
0:48 So create pages will be user email and let's go and set the types on all of these. Say it returns a page. Let's return the page. There we go.
1:04 Technically, we're not using it. I also noticed this is a great out are not using that yet pays creating user equals user email.
1:12 Now how we should be able to do this. Except for we're no longer calling it correctly here.
1:20 This is gonna be VM not a user dot email again because this is only called by these ones that require admin Means you have to have a user.
1:29 Don't need to check for that. Should be there. Can we create that? Page Will donate. Exist? Yes. Donate exists. And let's test it.
1:43 No, no page attribute Has no get All right. Almost there. Almost there. I guess we didn't check in that part of our the models, do we contents?
1:53 Yeah, I think that little little tiny change there might be all we needed. There it is. Check it out. Now. We're over on our site.
2:00 We go to donate, get a donate to the PSF. Here is the content you can inspect element on it and it looks just like what we have in our database.
2:12 How cool is that? So we have our website up and working. Let's go and go to the pages. Let's add the other two pages just so they're still around.
2:23 There are fake database and this one company history details about company history and I have the employees as well, which we're gonna call our team details about our employees.
2:46 Cool. Now we should be able to go to those pages. And just like before, company slash history comes up with us and our team as our team open the top.
2:55 Our team right there, details about our team. And, of course, the most important one we click on. The Donate gives us the right thing.
3:03 Finally, unless your seat in the database course it's gonna be there, right? But let's go open that up and here they are, created them again.
3:12 Creating user is me. There's all the details you would expect.
3:15 And there's even the contents of that one, which, you can see is like got the little new lines, their line breaks in it all the kind of stuff that we would hope that it has.
3:26 Perfect. We're now over in the database using sequel Commie as we should Be, and it's to celebrate. Let's go and delete that sucker right there.
3:36 Ah, let's view the usages so or technically not using it, but it's still imported in the CMA service. Get rid of that reruns. Safe Delete. Okay.
3:48 Yeah, I think we're ready. I don't know why I did it and already deleted. That's what that was. It's just gone. They're cool.
3:54 We're no longer using fake data. Everything is stored in the sequel light database right there.
3:58 We already had a ton of data in there, Remember, we had.
4:03 If we go over here like all of these things are already stored in there like Boto three and all the details about it, those were stored in there.
4:09 But now, in addition, we have our redirects and our pages also stored in the database.

Talk Python's Mastodon Michael Kennedy's Mastodon