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