1 00:00:00,000 --> 00:00:00,500 2 00:00:00,500 --> 00:00:02,700 SPEAKER: For quote we have three to-dos. 3 00:00:02,700 --> 00:00:06,270 We want to display the form for the user to look up the stock. 4 00:00:06,270 --> 00:00:08,970 We want to then retrieve the quote for that stock. 5 00:00:08,970 --> 00:00:12,990 And finally, display the current price for that stock. 6 00:00:12,990 --> 00:00:16,320 So for the display form, let's make another template. 7 00:00:16,320 --> 00:00:19,980 For instance, it can be called quote.HTML. 8 00:00:19,980 --> 00:00:22,110 So this will include a form that allows them 9 00:00:22,110 --> 00:00:26,170 to input the symbol of the stock the user wants to look up. 10 00:00:26,170 --> 00:00:29,020 Once we have that symbol, let's use the VLOOKUP function. 11 00:00:29,020 --> 00:00:32,080 Remember the implementation is found in helpers.py. 12 00:00:32,080 --> 00:00:37,580 That will return a dict with the name, price, and symbol of that stock. 13 00:00:37,580 --> 00:00:41,440 Now that we know how much the stock costs, let's tell the user. 14 00:00:41,440 --> 00:00:44,960 To display this information let's create another template. 15 00:00:44,960 --> 00:00:48,730 The reason for this is that the quote.HTML template that we've already 16 00:00:48,730 --> 00:00:52,780 made includes the form submission, whereas this information is 17 00:00:52,780 --> 00:00:54,260 going to be different. 18 00:00:54,260 --> 00:00:57,040 So we'll only display the stock information 19 00:00:57,040 --> 00:00:59,420 if the stock is, after all, valid. 20 00:00:59,420 --> 00:01:01,720 Otherwise, include another apology. 21 00:01:01,720 --> 00:01:07,210 So how do we pass on information and values that we have from a Python file 22 00:01:07,210 --> 00:01:09,040 into HTML? 23 00:01:09,040 --> 00:01:14,090 Well, when we call render a template we're allowed to pass in values. 24 00:01:14,090 --> 00:01:19,180 So if I had a template called hello.HTML within my main blog, 25 00:01:19,180 --> 00:01:22,330 then I could have a paragraph that simply said, "hello," 26 00:01:22,330 --> 00:01:24,970 and then had a placeholder for a name. 27 00:01:24,970 --> 00:01:30,140 Note these two curly braces allow me to reference a Python value. 28 00:01:30,140 --> 00:01:35,860 So within application.py, I would include a route to hello, 29 00:01:35,860 --> 00:01:40,720 and I would return render template, hello.HTML, and passing 30 00:01:40,720 --> 00:01:42,710 in the name "World." 31 00:01:42,710 --> 00:01:44,320 So what would I see in HTML? 32 00:01:44,320 --> 00:01:46,940 Well, it would replace name with "World!" 33 00:01:46,940 --> 00:01:51,520 So my page would say, "Hello, World! " Now that we've displayed the quote, 34 00:01:51,520 --> 00:01:55,660 let's go on and allow them to buy it if they decide that that stock is worth 35 00:01:55,660 --> 00:01:57,210 it. 36 00:01:57,210 --> 00:01:58,026