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