Python for Decision Makers and Business Leaders Transcripts
Chapter: Web development with Python
Lecture: Querying for real guitars
0:00 Well, this was fun.
0:01 But what we actually want is to have a way
0:03 to browse the guitars.
0:05 So, let's come in here and define one more thing
0:07 and then we'll put our demo app away.
0:11 We want all the guitars
0:13 and it's going to look really similar to this.
0:17 Let's go down here and say we want the guitars to be
0:21 somehow we're going to have to get those guitars
0:23 from somewhere in a moment.
0:25 And we'll just come down here and say this is the guitars
0:28 equal to the guitars. This is our variable.
0:30 This is the data name in the template.
0:33 And this will be guitars.
0:36 We've already added this cool little service
0:38 database thing.
0:39 So I can come over here and say catalog, service.
0:45 Pytrom knows about it and will write the thing
0:47 to us it up at the top
0:48 and then we just say all_guitars.
0:50 That will just say None.
0:52 So, that should return our guitars here.
0:55 And then we can just go and print it out.
0:57 We're going to need this guitar's file
0:59 so let's do that real quick and then we're going to
1:01 get it to be all guitars.
1:14 And each of these guitars has a name and a price
1:17 and so on.
1:18 We're just going to put the name out for just a second.
1:20 Let's see if that works. Go in your saved guitars.
1:28 Oh, whoops! Looks like I forgot to put this part member
1:31 that's required. Here we have it.
1:34 Here are all the guitars! Look how awesome that is!
1:36 Just those few lines, we've gone to the database
1:38 as we've got all these.
1:40 That course is not nearly as beautiful as
1:42 what we saw before.
1:43 so, the last thing to do will be to just drop in
1:45 a little bit of web design
1:47 and then we'll be actually done.
1:49 Kind of amazing.