Python for the .NET Developer Transcripts
Chapter: Web frameworks
Lecture: The guitars page

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Well, we have our homepage. Lets add the really important part the guitar catalog where you can go in and browse and filter in theoretically by
0:09 so were going to just duplicate that. And when we go over here and say /guitars like so. Now, here's a thing that's kind of funky in Python.
0:17 You got to be really careful about... This name exists but if you define it again in pure Python this is not an error. This one replaces that one.
0:28 Kind of wish that was an error, but its not. So you got to be super careful to remember to change this name because you don't get a compile error.
0:35 Although Flask itself does check, if you put an app.route on both it'll complain that you can't have app.route on two different
0:42 copies of the same named thing, for example Alright so let's go here I'm going to have a guitars
0:49 and we're going to get that by just copying and pasting that. And let's change the up here, we don't want all
0:58 this business. This is going to be much simpler. It's just going to be guitars or something like that we just we'll put it in some details in a minute.
1:09 We're also going to need to pass some data, so I'm going to say guitars, oh nope. Again, main conflict here lets say
1:16 guitar list or something like that, equals i'll put it empty. We're going to figure out how to get ahold of that
1:21 in a second, but lets just say guitars equals this empty guitar list over here. So we could do something like...
1:34 Here we go, we'll put the guitars out. Obviously we don't have any details for them. This is going to be the
1:38 basic idea, so we're going to have some buttons. Right here, like this little comment. Going to put some buttons here, this is our electric
1:49 guitars, acoustic guitars, all guitars and then we're just going to show them in a bunch of DIV's; With some CSS styles, and that's pretty much it.
1:57 Let's see if we fixed our crash. Can we browse the guitars? Yes! We can, now there's a few stylistic things that are massively broken.
2:06 Remember we need something up here to push that down. So that it shows up and doesn't go behind the navigation.
2:12 But notice, we have this cool, calming look and feel and then we do actually have this working, even though it's
2:17 sort of hidden their. So pretty cool, we've got this guitar view added, so all we did is just add another method
2:24 give it a route here that is unique and then we just called the template. Also notice in PyCharm, that you can jump over
2:31 to the template super easy like this. And that's pretty awesome actually.


Talk Python's Mastodon Michael Kennedy's Mastodon