Adding a CMS to Your Flask Web App Transcripts
Chapter: The redirects (our
Lecture: Creating the redirect

Login or purchase this course to watch this video and the rest of the course contents.
0:00 what was very neat. But I sure don't see our new redirect here. And that's because we're not done. I'm over here. It says we get all our date,
0:10 exchange and transformations. We did our validation and we stayed on the page If there's there and we did a redirect, but here it just said, Oh,
0:17 yeah, we would have done something with this But you know, we don't We're not sure what to do. So now it's timeto have something to do.
0:25 We can import the CMS service and we can say create redirect and what we wanna pass in about v m dot name v m dot short your l and V m
0:37 That's it right in there. Cool. How the view models are just got that data. You know that, like this is already trimmed and lower case.
0:46 Don't worry about that. This is already trimmed. Everything's good. Let's go and create that and say it's gonna take a name into
0:53 the string. Sure, you know how much the string and that which is Ah you know, string. I guess we should have a little test.
1:01 So we'll have something like if get redirect. I short your l we'll raise an exception.
1:21 It's not likely cause we've already tested it. But people mess with a view model,
1:24 they mess up that validation. We want to just have one more check here. So the data that we're gonna have let's go and look at our fake data.
1:34 It's gonna be this type of stuff right there. That's the structure we need. The data is gonna look like this.
1:42 I d Let's just do a random I ran into from 100 to something bigger. The euro is going to be,
1:57 well, the euro, the short your l is gonna be the short euro. And what you guys think the name is gonna be. Yeah, Not a lot to that,
2:06 is there? Yes, we have this data. Then we just say fake data of a reader. Rex short Euro is data, and that will put it back into that dictionary.
2:16 Fake in memory database. Exactly. Is all the others are cool, huh? All right, let's run that once again.
2:25 Take this through the entire loop of its life cycle. So over here in that man over here, we're gonna build a now, add a redirect.
2:32 Let's say we'll have on for talk Python and this would be talk and as this now that you created and look at that boom,
2:41 it does right there so we can test it. Notice at the bottom. The left the world's gonna request is Locos slash talk. Where do we end up? Yes,
2:52 exactly. Our new redirect was created, and then now it's working, just like as any of the other ones that were
2:58 there. Let's go and add just one more just for the fun of it. Let's call this Google. Guess you need a short way to type Google.
3:05 You just type G here. First list trying to have talk? No, we just out of that that already access. Well, I guess that's a weird name for Google.
3:15 Let's try G gold now exist. Test it perfect. Google is working just like you'd expect.
3:23 Now we can add these reader X dynamically there saved in our big little database. Remember, student of a real database.
3:29 But for now it's just a little in everything, and it looks like our adding new read Rex is totally nailed.

Talk Python's Mastodon Michael Kennedy's Mastodon