Adding a CMS to Your Pyramid Web App Transcripts
Chapter: Redirects and the admin section
Lecture: Cleaning up the html: Add vs. Edit
0:00 before we call this officially finished and put all the redirects aside, let's check out one more thing. There's something that's not amazing.
0:01 If I add a new redirect says, add new redirect, create redirect that school.
0:01 But when I edit one, however, I get to add a new one and created weight that save and change of this one. So let's update this page two.
0:01 Very based on whether we're editing or creating one, it turns out this is super easy. We just have to put in place over here. We say add new redirect.
0:01 So what we're gonna do, we can put one of these little chameleon string testy things that weakens you Assume, say, add new, if not redirect I D.
0:01 So we don't have a new i d that specified. Remember, this is the edit case we're gonna say, Add new else. We're gonna say, Edit the redirect.
0:01 Yeah, let's see if that works. You hear this should split to edit at it. Redirect it does. And if we go and have new one, here's an ad, a new one.
1:01 If we go and edit at perfect, we need something like that for create as well And you know what? It's the same bit of HTML our little test.
1:01 They're gonna put this in this instead of add new is gonna be re eight, and this is gonna be save, save redirect at it.
1:01 And if we go over here and create a new one, been a creator, redirect and add one. Maybe even we could change the color. That's totally possible.
1:01 But more just gonna leave him read for both. Yeah, there we go. We've cleaned up this page over here this page so that it's a little more meaningful.
1:01 Even put the name up here. Say we don't have title, do we? We have name. Here we go.
1:01 Edit the Python bites, redirect or we come over here and edit the courses. Redirect.
1:01 I'm not sure if I love it or not, but I'll leave it there so you'll have that flexibility now. I think this is pretty much done.
2:01 You can even see are cool little title that we put in there working for the hover when we don't have it empty so you don't see the placeholder. Great.
2:01 All right, Now our little editing CMS thing is