1
00:00:05,320 --> 00:00:11,510
Welcome back in this lecture we're going to talk about form fields pretty much every possible H.T. male

2
00:00:11,520 --> 00:00:15,970
form field has a corresponding W.T. forms class that you can then import.

3
00:00:16,080 --> 00:00:22,890
And these are fields like selecting a date time on your HTL form or just inputting text and W.T. forms

4
00:00:22,950 --> 00:00:28,500
also has validators that you can easily insert and validators can perform checks on the form data such

5
00:00:28,500 --> 00:00:33,760
as requiring a field to be filled or checking to see if a password meets certain requirements.

6
00:00:35,200 --> 00:00:39,670
So we're also going to talk about how to use flasks session object to grab the information provided

7
00:00:39,670 --> 00:00:41,990
in the form and pass it to another template.

8
00:00:42,220 --> 00:00:45,520
Keep in mind later on we're going to show you how to save this information.

9
00:00:45,520 --> 00:00:48,130
Once we understand databases with flask.

10
00:00:48,130 --> 00:00:53,890
So right now all we know how to do is grab the information that he provides in the form and then display

11
00:00:53,890 --> 00:00:56,710
it back in another template in the next section of the course.

12
00:00:56,710 --> 00:01:00,740
We'll show you how we can actually then save that information or check it against a database.

13
00:01:00,860 --> 00:01:05,350
But right now we're just going to show you how you can grab that information temporarily and show it

14
00:01:05,340 --> 00:01:06,170
in a template.

15
00:01:06,400 --> 00:01:09,080
OK let's get started by heading over to our text editor.

16
00:01:09,310 --> 00:01:09,550
All right.

17
00:01:09,550 --> 00:01:12,330
Here we are with our text editor right now.

18
00:01:12,340 --> 00:01:13,510
I just have basic pie.

19
00:01:13,530 --> 00:01:18,550
It's an empty Python script and I have an index that it's Tim L and a thank you that is T.M. pretty

20
00:01:18,550 --> 00:01:21,720
much our index home page is going to have a form with various fields.

21
00:01:21,790 --> 00:01:24,610
The user fills them out and then we think them a report back.

22
00:01:24,610 --> 00:01:26,610
The information on the thank you page.

23
00:01:26,770 --> 00:01:29,370
Let's get started by filling out this python form.

24
00:01:29,380 --> 00:01:32,940
I'm going to collapse that sidebar to give us a little more room.

25
00:01:32,950 --> 00:01:33,870
I will start from scratch.

26
00:01:33,880 --> 00:01:40,500
So I'll say from flask import and then we'll ask for a flask render template.

27
00:01:40,950 --> 00:01:45,630
We're going to also ask for a couple of new things we haven't seen before such as session.

28
00:01:45,960 --> 00:01:47,140
Redirect.

29
00:01:48,140 --> 00:01:54,560
And then also your L4 we've seen your L4 in the template side but there's also a corresponding function

30
00:01:54,650 --> 00:01:55,950
on the python script side.

31
00:01:56,150 --> 00:02:00,770
So we're going to be exploring both session redirects and you are a for in this lecture lots of cool

32
00:02:00,800 --> 00:02:02,640
fun stuff to learn.

33
00:02:03,350 --> 00:02:12,360
Then we'll say from flask underscore WDF import flask form and then from W.T. forms.

34
00:02:12,410 --> 00:02:14,380
I'm going to import that bunch of fields.

35
00:02:14,660 --> 00:02:20,680
So we're going to import a string field a Boolean field a date time field.

36
00:02:20,720 --> 00:02:26,540
So there's dates and date time field and then we also say let's say a radio field so just to show you

37
00:02:26,690 --> 00:02:28,510
the gamut of all the options here.

38
00:02:28,730 --> 00:02:35,510
And then we'll do a select field we'll do a text field and let's do a text area field.

39
00:02:35,690 --> 00:02:38,050
And then finally we need a submit field.

40
00:02:38,120 --> 00:02:38,520
OK.

41
00:02:38,690 --> 00:02:43,150
So just a quick note when you have a bunch of imports like this and you don't want them all in one line.

42
00:02:43,370 --> 00:02:48,740
Well you can do is you can wrap them with parentheses and that we can do the imports over multiple lines.

43
00:02:48,740 --> 00:02:52,700
So the sort of syntax is really common when you're running out of space.

44
00:02:52,730 --> 00:02:53,600
So there we go.

45
00:02:53,600 --> 00:02:57,740
Now we don't get an error with a multi-line import.

46
00:02:57,920 --> 00:03:00,290
OK so we have our imports from the various fields.

47
00:03:00,290 --> 00:03:09,570
The last thing I want to do is show you a simple validator we can say from W.T. forms validators import

48
00:03:10,040 --> 00:03:14,720
and there's various validators you can do one of the simplest ones is data required.

49
00:03:14,720 --> 00:03:20,840
Notice there's other things like email so you can check if a actual email was passed in for an e-mail

50
00:03:20,840 --> 00:03:21,510
input.

51
00:03:21,530 --> 00:03:26,000
For example check things like it has an at symbol there and it ends with dot com or dot org and all

52
00:03:26,000 --> 00:03:28,830
those sorts of things will keep revalidation simple for now.

53
00:03:28,880 --> 00:03:30,450
Just data required.

54
00:03:30,600 --> 00:03:35,330
It basically says hey we need you to fill this out in the form before we can hit submit.

55
00:03:35,390 --> 00:03:38,710
So I'll say that we have our imports ready to go.

56
00:03:38,960 --> 00:03:46,650
So let's create our application will say flask and then we're going to passen name and we're going to

57
00:03:46,650 --> 00:03:48,080
configure our secret key.

58
00:03:48,300 --> 00:03:55,600
So we do this by saying app that config and then we Passons secrets underscore key in all caps.

59
00:03:55,800 --> 00:03:57,810
And then you set this to any string you want.

60
00:03:57,870 --> 00:04:04,000
So I'll say my secret key or my key does really matter for our local purposes right now.

61
00:04:04,050 --> 00:04:05,600
We have our application ready to go.

62
00:04:05,610 --> 00:04:13,060
So we're going to now create a form class recall that usually for larger applications we have a separate

63
00:04:13,060 --> 00:04:18,970
forms up-I file for this but we're keeping everything from just one simple pie file and we're going

64
00:04:18,970 --> 00:04:27,280
to create again in info form and we inherit from flask form and then we're going to have a bunch of

65
00:04:27,280 --> 00:04:28,170
attributes here.

66
00:04:28,210 --> 00:04:29,970
So the attributes we're going to use.

67
00:04:30,010 --> 00:04:32,730
Let's have a breed so kind of make this puppy thing again.

68
00:04:32,930 --> 00:04:37,130
Springfield we'll ask what breed are you.

69
00:04:37,130 --> 00:04:39,730
So remember that's the label for that string field.

70
00:04:40,030 --> 00:04:43,860
And I can also pasan a parameter for validators.

71
00:04:43,900 --> 00:04:46,420
So by default the validators are none.

72
00:04:46,420 --> 00:04:52,780
Boy you can do is send pass any list of validators that you imported from W.T. forms validators and

73
00:04:52,780 --> 00:04:58,840
I've imported data required so that basically says you need to fill out this actual form here.

74
00:04:58,890 --> 00:05:01,940
Or at least this part of the form in order to submit it.

75
00:05:01,960 --> 00:05:05,900
So what we do is validators is a list of validator objects.

76
00:05:06,070 --> 00:05:07,860
So I say data required.

77
00:05:07,870 --> 00:05:09,480
And then I have open close princes.

78
00:05:09,490 --> 00:05:15,340
So actually create an instance of the state a required object to pass into validators and then through

79
00:05:15,340 --> 00:05:22,440
the magic of W.T. forms it will end up requiring the person to provide data there for the Breede input.

80
00:05:23,980 --> 00:05:25,060
All right so we have a breed.

81
00:05:25,150 --> 00:05:28,360
Let's go ahead and create an object for neutered souls.

82
00:05:28,450 --> 00:05:36,420
Check if the puppy has been neutered so I'll say Boolean field have human neutered for it's puppy you've

83
00:05:36,430 --> 00:05:39,980
been neutered it's kind of up to you ask this question.

84
00:05:39,980 --> 00:05:40,580
There we go.

85
00:05:40,610 --> 00:05:44,580
And then let's continue on with mood Sofer mood.

86
00:05:44,610 --> 00:05:47,160
Let's have this be a radio field selection.

87
00:05:47,460 --> 00:05:54,840
So the way radio fields work it's a bunch of radio buttons and they will say please choose your mood.

88
00:05:55,140 --> 00:05:56,510
Remember for radio buttons.

89
00:05:56,520 --> 00:05:57,830
You can only pick one.

90
00:05:57,840 --> 00:06:04,050
So as you pick one all the others get de-selected So what you do here is you pasand choices and choices

91
00:06:04,060 --> 00:06:12,440
is going to be a list of tuple pairs and tuple pairs essentially give a value and a label.

92
00:06:12,510 --> 00:06:16,050
So it starts off with a value.

93
00:06:16,200 --> 00:06:18,690
So we'll call this mood underscore one.

94
00:06:18,690 --> 00:06:23,700
And I'm going to zoom out a little bit and start choices on a new line here so you can get an idea just

95
00:06:23,760 --> 00:06:25,200
for better reference.

96
00:06:25,200 --> 00:06:27,250
So again we have a radio field choices.

97
00:06:27,270 --> 00:06:29,370
It's going to be a list of tuples pairs.

98
00:06:29,760 --> 00:06:35,940
And the first value or the first string is your value and then the second one is the actual label that

99
00:06:35,940 --> 00:06:37,470
a person is going to see on that radio button.

100
00:06:37,500 --> 00:06:42,770
So we can say happy and then let's add one more we'll say mood to

101
00:06:45,500 --> 00:06:48,000
and we'll have that be excited.

102
00:06:48,090 --> 00:06:53,340
So puppies are either happy or excited and then we'll do another attribute here.

103
00:06:54,220 --> 00:06:57,280
And this attribute is going to be called let's see.

104
00:06:57,310 --> 00:06:58,920
Let's have it be food choice.

105
00:07:02,310 --> 00:07:13,360
And for this we'll say select field and here we're going to ask to pick your favorite food and something

106
00:07:13,360 --> 00:07:15,680
that may happen depending on what OS you're using.

107
00:07:15,910 --> 00:07:18,200
Sometimes this needs to be a unicode string.

108
00:07:18,220 --> 00:07:22,280
So what you can do is put a you right in front of the string to make sure you don't get any errors.

109
00:07:22,480 --> 00:07:24,100
That doesn't happen on every OS.

110
00:07:24,100 --> 00:07:28,220
Just keep in mind I'm going to put it here just to make sure you don't get any errors.

111
00:07:28,240 --> 00:07:32,600
Often you can just provide the string and you'll have no errors but will put in Unicode here for select

112
00:07:32,600 --> 00:07:34,580
field just to make sure it works for us.

113
00:07:35,290 --> 00:07:39,090
And then the select field it's going to be really similar to radio field.

114
00:07:39,130 --> 00:07:44,080
As far as the choices parameter so you have these choices parameter and it's going to be again a list

115
00:07:44,140 --> 00:07:50,530
of tuple pairs where the first item in this tuple pair is the value code that you're going to be using

116
00:07:50,530 --> 00:07:51,760
throughout your Flast group.

117
00:07:51,850 --> 00:07:54,940
And the second one is what the actual user Seasonale Web site.

118
00:07:55,150 --> 00:07:57,230
So something like chicken is what the user sees.

119
00:07:57,280 --> 00:08:00,700
And on the back end we just call it CHC for short.

120
00:08:01,630 --> 00:08:06,850
And then we can have something like B.F. and we'll have that be related to the beef option that the

121
00:08:06,850 --> 00:08:11,050
user sees and create some more options here on our list.

122
00:08:11,050 --> 00:08:17,790
We can say something like fish as a value and have that label fish and it's good provide one more we

123
00:08:17,790 --> 00:08:20,470
have chicken B fish actually should be enough.

124
00:08:20,940 --> 00:08:24,070
So let's put this in the mixture.

125
00:08:24,420 --> 00:08:26,060
We have that on the list.

126
00:08:26,070 --> 00:08:26,460
There we go.

127
00:08:26,460 --> 00:08:29,080
So we have our list of choices as duple pears.

128
00:08:29,370 --> 00:08:31,380
And now we're ready to go.

129
00:08:31,530 --> 00:08:34,510
Let's just have one more option here.

130
00:08:35,550 --> 00:08:38,110
And the last one is going to be as far as the attribute.

131
00:08:38,640 --> 00:08:40,660
To make sure we get it lined up correctly.

132
00:08:40,740 --> 00:08:46,730
There we go the attributes going to be feedback and we'll just have this be a text area a field which

133
00:08:46,730 --> 00:08:49,500
essentially just a large box where someone can write whatever they want.

134
00:08:50,700 --> 00:08:53,870
And they'll have a submit button so I'll say submit field.

135
00:08:54,100 --> 00:08:57,140
I'll say just submit.

136
00:08:57,380 --> 00:08:57,710
All right.

137
00:08:57,710 --> 00:08:58,960
So this is our form.

138
00:08:59,060 --> 00:09:03,830
As you can see this form is quite complicated given what we've done in the past which is why usually

139
00:09:04,070 --> 00:09:08,600
you're going to have a separate forms that file where you'll set up your info form and then your application

140
00:09:08,600 --> 00:09:11,780
you'll just say from forms import info form.

141
00:09:11,780 --> 00:09:17,420
But right now we set up the form in the same application that profile we have this if a form has an

142
00:09:17,420 --> 00:09:20,640
option for providing your Breede notice that's going to be required.

143
00:09:20,660 --> 00:09:23,170
So a user has to provide that before hitting submit.

144
00:09:23,280 --> 00:09:27,380
It will have a Boolean field which is up to you to choose one or the other.

145
00:09:27,560 --> 00:09:33,680
And then we have radio field select field text area of field and then a submit button.

146
00:09:33,710 --> 00:09:35,650
So we set up our form.

147
00:09:35,660 --> 00:09:39,140
Now it's time to actually set up our index page with the form.

148
00:09:39,200 --> 00:09:45,860
So the next step here is to set up our index page will see the routes or go to the home page by saying

149
00:09:45,860 --> 00:09:49,180
just forward slash and then the methods.

150
00:09:49,480 --> 00:09:52,240
Just like last time it's going to be a list with get and post

151
00:09:55,600 --> 00:10:00,510
and then we'll say the index and we'll start setting up our index function.

152
00:10:00,520 --> 00:10:02,070
Let's add some new lines here.

153
00:10:02,080 --> 00:10:06,100
Remember you can always copy and paste from the provided notes KCA any syntax errors.

154
00:10:06,250 --> 00:10:10,270
But we're going to create an instance of our form object we'll just call it form and it's going to be

155
00:10:10,270 --> 00:10:17,510
an instance of our info form and then we'll say if form dot valid day on submit.

156
00:10:17,710 --> 00:10:21,550
So once they hit the submit button essentially we're going to do is going to grab data from the Breede

157
00:10:21,610 --> 00:10:22,830
on the form.

158
00:10:22,840 --> 00:10:28,420
Now the way we can do this in order to pass in all this data into another template automatically We're

159
00:10:28,420 --> 00:10:34,340
going to be using if we scroll back up here the session object we imported from flask.

160
00:10:34,530 --> 00:10:41,220
And unlike a cookie basically session data is stored on the server and a session is just a time interval

161
00:10:41,400 --> 00:10:45,410
from when a client is logging in or connecting to that server and then logs out of it.

162
00:10:45,570 --> 00:10:47,110
So it's not going to be permanently saved.

163
00:10:47,160 --> 00:10:52,380
It's just a particular obsession for the user who filled out that form and then went to another page.

164
00:10:52,410 --> 00:10:57,480
So the data which is actually needed to be held across the session is essentially stored in a temporary

165
00:10:57,480 --> 00:10:58,890
directory on the server.

166
00:10:58,890 --> 00:11:01,300
So this is not a way to permanently store something.

167
00:11:01,440 --> 00:11:05,190
It's just a way to hold information for a particular session for a user.

168
00:11:05,250 --> 00:11:08,880
And we actually have even talked about official user authentication or registration yet.

169
00:11:09,030 --> 00:11:13,860
So think of this kind of a very basic way to report back information that the user provides in a form

170
00:11:14,190 --> 00:11:18,510
later on we're going to learn how to save it and how to actually attribute it to a specific user that's

171
00:11:18,510 --> 00:11:21,150
logged then the start of the basics here.

172
00:11:21,150 --> 00:11:25,340
So we're going to do when we say form validate or submit.

173
00:11:25,610 --> 00:11:30,640
I'm going to grab that session object and you can essentially treat it as a dictionary.

174
00:11:30,690 --> 00:11:36,300
So we're going to create a new key in the session dictionary called breed and we're going to set that

175
00:11:36,300 --> 00:11:40,610
equal to form read data.

176
00:11:40,710 --> 00:11:47,220
Remember that the general syntax is to say your form the created appear form is to perform grab whatever

177
00:11:47,220 --> 00:11:51,990
attribute you're interested in number all these attributes are essentially as fields and then you say

178
00:11:52,250 --> 00:11:59,460
data and that grabs what the user provided for that actual field and keep in mind your data for things

179
00:11:59,460 --> 00:12:01,230
like radio field and select field.

180
00:12:01,380 --> 00:12:03,930
That's going to report back your internal value.

181
00:12:03,960 --> 00:12:06,480
It's not going to report back what the user saw.

182
00:12:06,570 --> 00:12:08,570
So often you may want to keep these the same.

183
00:12:08,570 --> 00:12:09,790
That way there's no confusion.

184
00:12:09,960 --> 00:12:14,430
But maybe if you have a really complex choice that the user is going to see it might be easier to give

185
00:12:14,430 --> 00:12:17,850
it a shorter value maybe chicken is just too large to store around.

186
00:12:17,850 --> 00:12:23,490
So you want to say CHC again this is starting to get to personal preference as far as how you like to

187
00:12:23,490 --> 00:12:25,850
combine your value label pairs here.

188
00:12:25,860 --> 00:12:29,880
So just something to keep in mind and we'll see this in more detail in just a little bit.

189
00:12:31,120 --> 00:12:32,600
I'm going to say session.

190
00:12:32,690 --> 00:12:40,350
And then let's add an neutered and we'll say form neutered data.

191
00:12:40,690 --> 00:12:43,620
So it's going to be a boolean value whether or not they're neutered.

192
00:12:43,630 --> 00:12:47,490
Let's see we also have mood of the dog or the puppy.

193
00:12:47,490 --> 00:12:50,710
It's going to be form mood data.

194
00:12:52,430 --> 00:12:54,250
And they'll keep adding more stuff to this.

195
00:12:54,250 --> 00:12:56,000
We also have their food choice.

196
00:12:56,170 --> 00:13:02,140
So I'm going to call it food for the key we'll say form through choice.

197
00:13:02,230 --> 00:13:07,430
Grab the data on their food choice and then I believe they also have feedback that they can get back

198
00:13:07,440 --> 00:13:16,400
I will say the feedback he is equal to form the feedback that data.

199
00:13:16,420 --> 00:13:17,350
All right.

200
00:13:17,350 --> 00:13:22,870
So once that's all done what I'm going to do is I'm going to return and this is where we're going to

201
00:13:22,870 --> 00:13:26,830
use the redirect and your all for though we just imported so appear at the top.

202
00:13:26,830 --> 00:13:32,500
Remember I imported redirect and your all for this is really useful when you want to just automatically

203
00:13:32,770 --> 00:13:38,480
have a form redirect upon submission instead of messing around the DML code to make sure that works.

204
00:13:38,530 --> 00:13:42,360
You can actually use redirect and you are all four from your Python script.

205
00:13:42,370 --> 00:13:43,680
So that's a little nicer that way.

206
00:13:43,680 --> 00:13:48,670
Your template files are as simple as possible and you really leverage the power of Python over here

207
00:13:48,670 --> 00:13:49,490
in flask.

208
00:13:49,780 --> 00:13:57,890
So we're going to do is say return redirect and essentially linked up with that action on submitting

209
00:13:57,890 --> 00:13:59,220
and HTL form.

210
00:13:59,240 --> 00:14:05,180
And then we say your L4 and then we passen a string of whatever the function's going to be called for

211
00:14:05,180 --> 00:14:07,730
the other view and I'll say thank you.

212
00:14:07,880 --> 00:14:11,840
And then I haven't actually created this view function yet but I will in just a little bit.

213
00:14:11,930 --> 00:14:17,760
So notice here the actual indentation of this is going to zoom out so we can see this indentation clearly.

214
00:14:17,960 --> 00:14:21,370
I'm saying the F index for info for.

215
00:14:21,440 --> 00:14:27,950
And then if the form is valid on submission I grab all the data and add it to that users session and

216
00:14:27,950 --> 00:14:36,500
then I return a redirect for the thank you all what I'm going to do for the overall return of this function

217
00:14:36,590 --> 00:14:40,540
is say render template and then pasan index.

218
00:14:40,550 --> 00:14:46,210
H T M L and then say form is equal to form.

219
00:14:46,300 --> 00:14:46,670
All right.

220
00:14:46,670 --> 00:14:49,710
So why do I have a redirect return.

221
00:14:49,730 --> 00:14:51,080
And the rendered template turn.

222
00:14:51,320 --> 00:14:57,570
Well that's because when I have my index page the very first thing they should see is the form.

223
00:14:57,710 --> 00:15:01,910
So I want to render my index outdates HTML page and pass in that form.

224
00:15:02,030 --> 00:15:07,270
It's only upon submission of the form where I want to grab the data and then redirect them.

225
00:15:07,310 --> 00:15:10,520
Which is why I have two returns this bottom return.

226
00:15:10,520 --> 00:15:16,010
That's the original rendering of the home page and then the second redirection return only happens when

227
00:15:16,010 --> 00:15:17,330
they submit the form.

228
00:15:17,330 --> 00:15:23,000
So keep in mind here the indentation what matches up with what this redirect return that's only for

229
00:15:23,000 --> 00:15:24,010
this if statement.

230
00:15:24,080 --> 00:15:26,510
This rendered template that's for the entire function.

231
00:15:26,510 --> 00:15:30,740
So that's the first thing the user sees and then they get redirected for the thank you page only upon

232
00:15:30,740 --> 00:15:33,980
a valid submission and this validate on Submit.

233
00:15:34,100 --> 00:15:37,010
Well that's going to do is it's going to check for these validators.

234
00:15:37,010 --> 00:15:41,550
So it's going to check that it makes sure to actually provide data for the Springfield here.

235
00:15:41,690 --> 00:15:46,520
And if they did not then it's not going to be valid on submission and they're not going to be redirected.

236
00:15:46,520 --> 00:15:51,020
So that's really start to leverage the power here of these W.T. forms.

237
00:15:51,570 --> 00:15:52,010
OK.

238
00:15:52,130 --> 00:15:56,270
So I just mentioned that I have a redirect you are all for a thank you page which means I should probably

239
00:15:56,270 --> 00:15:58,300
make a thank you page.

240
00:15:58,520 --> 00:16:01,330
So we'll say routes is thank you.

241
00:16:02,070 --> 00:16:05,030
And we'll have that function here just say thank you.

242
00:16:05,910 --> 00:16:11,570
And we're going to return render template for thank you.

243
00:16:11,730 --> 00:16:13,990
T.M. save that.

244
00:16:14,270 --> 00:16:20,350
And at the very bottom of all this will say if name is equal to Main take my app and run it it will

245
00:16:20,350 --> 00:16:22,500
say de-bug is equal to true.

246
00:16:22,750 --> 00:16:24,570
Just in case we have any issues there.

247
00:16:25,060 --> 00:16:25,360
All right.

248
00:16:25,390 --> 00:16:28,570
So that's everything we need to do for actual flask application.

249
00:16:29,530 --> 00:16:34,030
In part 2 of this series of lectures we're then going to fill out the templates and match it up with

250
00:16:34,030 --> 00:16:35,980
the views that we set up here.

251
00:16:36,010 --> 00:16:38,650
So let's just do a quick review of everything we've done.

252
00:16:38,710 --> 00:16:43,570
We did our imports and we have a couple of new imports so we haven't seen before such as redirect and

253
00:16:43,570 --> 00:16:46,130
you are a 4 as well as using that session.

254
00:16:46,240 --> 00:16:50,770
We imported a bunch of different fields from W.T. forms and you can always look up in the documentation

255
00:16:51,070 --> 00:16:53,330
the various forms and fields that are available.

256
00:16:53,470 --> 00:16:57,350
And then we also are using a validator and the one we're using right now is data required.

257
00:16:57,490 --> 00:17:01,560
There's also lots of different validators you can check for in the documentation.

258
00:17:01,730 --> 00:17:08,660
Then we create our application set up a secret key in our configuration then we set up a form inside

259
00:17:08,660 --> 00:17:11,220
of this basic thought PI file of a bunch of different fields.

260
00:17:11,330 --> 00:17:17,000
One of them has that validator Roamer that a validators parameter is a list of validator objects that

261
00:17:17,000 --> 00:17:19,900
have been created so that's where we need to open close parentheses there.

262
00:17:20,360 --> 00:17:24,740
And then we have this route for index page methods equal to get posts.

263
00:17:24,800 --> 00:17:31,400
We create the form and say if the form is valid on submission then we save all this data to the session

264
00:17:31,400 --> 00:17:35,930
object the session object can be basically be treated like a dictionary and we're saving it and then

265
00:17:35,930 --> 00:17:38,660
we're going to send it back to the thank you page.

266
00:17:38,660 --> 00:17:44,120
Later on you'll see that we don't need to actually say sessions equal to session anywhere in the template

267
00:17:44,360 --> 00:17:49,190
it's just automatically through our fast flask application available to us in the template page.

268
00:17:49,220 --> 00:17:53,160
So we're going to see that in the next lecture and then we just have a redirect for you.

269
00:17:53,210 --> 00:17:58,310
Upon submission and the original render template is just the home page with this form that we have that

270
00:17:58,310 --> 00:17:59,390
think Page.

271
00:17:59,450 --> 00:17:59,940
OK.

272
00:18:00,140 --> 00:18:04,310
So in part two we're going to be filling out this index that simple and this think that Ishmail will

273
00:18:04,340 --> 00:18:05,010
see next.
