1
00:00:05,410 --> 00:00:09,010
Welcome back, everyone, to this lecture on creating models and fields.

2
00:00:10,150 --> 00:00:12,520
In this lecture, we're going to be doing a couple of things.

3
00:00:12,910 --> 00:00:15,970
First, we're going to quickly create a new project and application.

4
00:00:16,000 --> 00:00:17,920
Hopefully this feels like review at this point.

5
00:00:18,400 --> 00:00:21,610
Then we're going to check out how to register a database in the settings.

6
00:00:21,910 --> 00:00:25,030
A lot of this is done automatically for us upon creating the project.

7
00:00:25,270 --> 00:00:27,490
But I do want to show you where these settings are located.

8
00:00:27,940 --> 00:00:33,510
Then we are going to run a migrate command to create the actual database that is using Python Managed

9
00:00:33,520 --> 00:00:37,240
Up Pie Migrate, and then we'll create an example model with fields.

10
00:00:38,690 --> 00:00:43,520
Now we're going to do is imagine that we've been hired by a dentist office to create some sort of software

11
00:00:43,520 --> 00:00:45,410
for their office to keep track of patients.

12
00:00:45,800 --> 00:00:49,910
And it would be really great if we could then store patient information in a database like their name

13
00:00:49,910 --> 00:00:50,660
and age.

14
00:00:50,840 --> 00:00:55,580
So clearly, we want to create a model called patient that has those two fields, a name and an age.

15
00:00:56,870 --> 00:01:01,220
So to do this, we're also going to be exploring documentation as we go along, including the setting

16
00:01:01,220 --> 00:01:05,810
up databases in the settings that pie page and the documentation, the different backgrounds that are

17
00:01:05,810 --> 00:01:06,260
available.

18
00:01:06,380 --> 00:01:10,310
It's actually a whole section of documentation about how to connect to different backgrounds and then

19
00:01:10,310 --> 00:01:12,750
also the different fields that are available for general models.

20
00:01:12,770 --> 00:01:16,730
There's an entire section in the documentation that lists all the fields available.

21
00:01:17,790 --> 00:01:22,710
OK, now in the next lecture, we're going to continue with a further discussion on migrations, including

22
00:01:22,710 --> 00:01:23,970
the Make Migrations Command.

23
00:01:24,360 --> 00:01:28,200
So we'll discuss in a lot more detail how these migrations work in the very next lecture.

24
00:01:28,500 --> 00:01:30,900
For right now, let's just set up the basics and get started.

25
00:01:31,230 --> 00:01:32,400
Head over to my code editor.

26
00:01:33,530 --> 00:01:38,540
All right, here we are inside of a folder called Jingle Lectures, it's on my desktop, it's totally

27
00:01:38,540 --> 00:01:41,420
empty right now, so let's create a new project, a new app.

28
00:01:41,750 --> 00:01:43,850
Hopefully, this feels super familiar to you by now.

29
00:01:44,270 --> 00:01:49,160
Again, we just called the Django admin tool at the command line and then we can say Start Project.

30
00:01:49,790 --> 00:01:54,170
And let's call this project my let's say site.

31
00:01:54,350 --> 00:01:58,100
If you want, you can call it my dental site or something like that, but we're going to call it my

32
00:01:58,100 --> 00:01:58,880
site again.

33
00:01:58,880 --> 00:02:01,040
Note that creates this project level folder.

34
00:02:01,370 --> 00:02:06,650
And then we have managed our pie inside of that and then settings, URLs, etc. I'm then going to change

35
00:02:06,650 --> 00:02:11,360
directory into my site in order to access manage that pie.

36
00:02:11,480 --> 00:02:14,570
And from there, what I'm going to do is create a new application.

37
00:02:14,780 --> 00:02:22,070
I can do that with Python, Manage Stop Pie Start app and this application, we can call it maybe the

38
00:02:22,070 --> 00:02:25,520
office application because it's just going to keep track of the patients.

39
00:02:25,640 --> 00:02:30,860
It's kind of up to you how you want to separate the idea of the application versus the models associated

40
00:02:30,860 --> 00:02:31,760
with that application.

41
00:02:32,060 --> 00:02:37,280
It really depends on your website, the scope of the website, scope of the application versus the project.

42
00:02:37,550 --> 00:02:39,410
And there's no real right or wrong answer here.

43
00:02:39,680 --> 00:02:41,900
It just kind of depends on what you're thinking of.

44
00:02:42,380 --> 00:02:43,880
So I'll go ahead and start that.

45
00:02:44,360 --> 00:02:47,150
And now we have an office application.

46
00:02:48,070 --> 00:02:48,430
OK.

47
00:02:48,790 --> 00:02:54,340
With that being said, let's go back to my site and explore the settings that pie file.

48
00:02:54,910 --> 00:02:59,890
So if you open up settings about pie file and you begin scrolling around through it, you'll notice

49
00:02:59,890 --> 00:03:06,790
eventually there's a section called databases, and this is where you can actually set the database

50
00:03:06,790 --> 00:03:11,110
engine, as well as the name or location of the database.

51
00:03:11,500 --> 00:03:12,700
So there's two key things here.

52
00:03:12,760 --> 00:03:14,770
One first is the engine.

53
00:03:15,220 --> 00:03:20,260
By default, Django selects sequel like three, which is what we're going to be using as your engine.

54
00:03:20,260 --> 00:03:24,950
Because Django knows that if you're using Django by default, then that means you have Python installed.

55
00:03:24,970 --> 00:03:27,880
And if you have Python installed, then SQLite three came with it.

56
00:03:27,910 --> 00:03:31,840
So Django knows for sure that you have SQLite three if you're able to use Django.

57
00:03:32,080 --> 00:03:35,650
It doesn't necessarily know for sure if you have Michael or PostgreSQL, etc..

58
00:03:35,950 --> 00:03:39,460
So that's why it doesn't include those, but we can easily swap out the engine.

59
00:03:39,850 --> 00:03:46,180
We'll show you how to do that in just a second, but the name component is also an extension of the

60
00:03:46,180 --> 00:03:49,180
base directory along with that SQLite three.

61
00:03:49,690 --> 00:03:52,870
So essentially, what this is saying is inside your base directory.

62
00:03:53,500 --> 00:03:55,570
Note that that was defined up here.

63
00:03:55,600 --> 00:03:57,760
It's basically your current parent directory.

64
00:03:58,180 --> 00:04:02,170
You can see you can build paths in the project with Base Directory forward slash subdirectory.

65
00:04:02,500 --> 00:04:08,290
You seen me do this with the OS system just because that's kind of a more old-school way to do it,

66
00:04:08,290 --> 00:04:09,650
but I prefer it that way.

67
00:04:09,670 --> 00:04:14,380
But you can't technically also just say based directory, forward slash and then the subdirectory so

68
00:04:14,380 --> 00:04:16,420
that it's also OK to build paths that way.

69
00:04:16,660 --> 00:04:19,420
But can you see me do it with Import OS Joint Path?

70
00:04:19,420 --> 00:04:22,240
But this is the way you can do it as well.

71
00:04:23,020 --> 00:04:25,060
All right, so scrum are coming back down here.

72
00:04:25,360 --> 00:04:29,650
We can see we have the engine and by default, the back end was sequel like three.

73
00:04:29,920 --> 00:04:31,810
But let me show you in the documentation page.

74
00:04:31,810 --> 00:04:36,910
If you go to this link on Settings databases, I want to show you what that looks like.

75
00:04:37,420 --> 00:04:40,510
So let me bring in that link underneath settings.

76
00:04:41,170 --> 00:04:46,900
So if you go to the Settings page underneath Django Project RT.com or Docs Django Project.

77
00:04:47,170 --> 00:04:48,910
So again, here I am at Settings.

78
00:04:48,970 --> 00:04:51,760
This is all the documentation that has to do with the settings that py file.

79
00:04:52,090 --> 00:04:56,140
You can scroll down eventually until you get to the database section, which has to do with that.

80
00:04:56,530 --> 00:05:00,530
So click on database and it says, OK, here's the default engine name.

81
00:05:00,850 --> 00:05:07,120
But clearly, if you end up using other database back ends like Michael, PostgreSQL etc, you're going

82
00:05:07,120 --> 00:05:09,490
to end up adding more information here.

83
00:05:09,520 --> 00:05:13,720
For example, let's imagine you had already a PostgreSQL database set up somewhere.

84
00:05:14,020 --> 00:05:17,510
Well, then you have to tell Django some information in order to interact with it.

85
00:05:17,530 --> 00:05:22,240
So here's a very simple example, like adding in the name the user the password host port.

86
00:05:22,570 --> 00:05:27,730
I should make a recommendation that typically you wouldn't just put in your password like this as a

87
00:05:27,820 --> 00:05:28,570
plain string.

88
00:05:28,810 --> 00:05:33,310
You would actually grab this from some sort of environment file, but more on that later.

89
00:05:33,610 --> 00:05:39,490
You can also click on the engine link here, and that will take you to the string quotes for the engines

90
00:05:39,490 --> 00:05:40,240
that are supported.

91
00:05:40,270 --> 00:05:43,840
Like PostgreSQL, my sequence equals three and Oracle.

92
00:05:44,290 --> 00:05:48,820
Keep in mind, these are the ones that are built in and shipped directly off Django, so you don't need

93
00:05:48,820 --> 00:05:50,950
to worry about adding any external library.

94
00:05:51,550 --> 00:05:56,800
Databases, however, are beyond just these for here in school, like three that actually supports a

95
00:05:56,800 --> 00:05:57,490
lot more than that.

96
00:05:57,730 --> 00:05:59,860
You just would need to install additional libraries.

97
00:06:00,670 --> 00:06:06,250
And if you go to the databases section of the documentation, it has a lot more details on this like

98
00:06:06,520 --> 00:06:12,250
PostgreSQL, my SQL, Oracle, etc. And then it says database back ends provided by third parties.

99
00:06:12,640 --> 00:06:18,400
So if you click on that, these are more third party back end that they're technically not officially

100
00:06:18,400 --> 00:06:22,570
supported right out of the box by Django, but they're good enough that Django includes them in the

101
00:06:22,570 --> 00:06:23,320
documentation.

102
00:06:23,320 --> 00:06:29,770
So things like Ms SQL Server, Google Cloud Spanner, Firebird, Cockroach DB, and there's even more

103
00:06:30,010 --> 00:06:34,510
unofficial projects that things like MongoDB you can check out.

104
00:06:34,510 --> 00:06:39,430
If you just do a Google search for Django plus MongoDB, you'll eventually find an additional library

105
00:06:39,430 --> 00:06:44,740
that ends up connecting your settings up file to that specific database, as we keep mentioning.

106
00:06:44,980 --> 00:06:49,330
If you're just starting out, you should really just start out on sequel like three and then maybe move

107
00:06:49,330 --> 00:06:54,640
on to a sequel tabular database, and the instructions for connecting of those are pretty much all here.

108
00:06:55,030 --> 00:07:01,450
So you can see there's different instructions on how to connect and how to name into these variety of

109
00:07:01,450 --> 00:07:02,440
different databases.

110
00:07:02,440 --> 00:07:06,100
And if you click on one of these, for example, let's say you're really interested in using PostgreSQL.

111
00:07:06,370 --> 00:07:11,860
You would just go to the database documentation section, click on PostgreSQL, and it has the full

112
00:07:11,860 --> 00:07:16,360
instructions on how to host, how to connect to it, how to save stuff in a configuration file, and

113
00:07:16,360 --> 00:07:19,690
then more information on optimizing the configuration.

114
00:07:19,720 --> 00:07:26,020
So there are a ton of links, step by step resources all here for you inside the documentation.

115
00:07:26,410 --> 00:07:30,700
Now, as I mentioned, we're really just working on the stuff that's directly available for us right

116
00:07:30,700 --> 00:07:31,720
out of the gate.

117
00:07:32,050 --> 00:07:34,180
So that's we're going to be using SQL like three.

118
00:07:35,270 --> 00:07:39,470
OK, so I know that was kind of a lot for the settings, but hopefully that gives you a better understanding

119
00:07:39,770 --> 00:07:41,690
of how this is actually working on the back end.

120
00:07:41,700 --> 00:07:45,820
This engine is already built into Django and there's other engines available for us.

121
00:07:45,830 --> 00:07:49,670
And then this name is basically pointing where is the actual database?

122
00:07:49,790 --> 00:07:55,220
Now you may be wondering, Well, this is saying it's underneath my base directory under that SQL like

123
00:07:55,220 --> 00:07:55,580
three.

124
00:07:56,000 --> 00:07:59,990
But if I take a look at my base directory, I actually don't see that database file.

125
00:08:00,350 --> 00:08:03,440
And that's because we haven't actually run any migrations yet.

126
00:08:03,800 --> 00:08:09,350
We would first need to run the migrate command in order to actually create this database.

127
00:08:09,360 --> 00:08:11,150
And we've done this before one time.

128
00:08:11,450 --> 00:08:15,560
And I mentioned last time we did it that this really had more to do with the database creation.

129
00:08:15,860 --> 00:08:19,850
So let's go ahead and explore it inside my terminal.

130
00:08:20,210 --> 00:08:24,050
What I'm going to do is I'm going to say Python.

131
00:08:25,730 --> 00:08:26,810
Managed pie.

132
00:08:28,220 --> 00:08:35,659
Migrate, I'm going to enter, and so you would notice that after this, what really happens here is

133
00:08:35,659 --> 00:08:39,559
the Migrant Command is looking at the installed apps setting.

134
00:08:40,039 --> 00:08:44,350
So we scroll up here and you notice we have the default installed apps.

135
00:08:44,360 --> 00:08:47,390
We haven't actually connected the office up to be installed there yet.

136
00:08:47,870 --> 00:08:54,140
But what this does is it takes a look at your default installed apps or any apps you add to this list,

137
00:08:54,530 --> 00:08:59,930
and there's going to create any necessary database tables according to the settings that you had under

138
00:08:59,930 --> 00:09:00,710
database settings.

139
00:09:01,010 --> 00:09:07,280
So because we have the settings underneath SQLite three, you notice we now have this DB that sequel

140
00:09:07,280 --> 00:09:10,680
like three, this is the actual database if you were to click on this.

141
00:09:10,970 --> 00:09:15,920
You can't actually see this in an editor because it uses binary, so you can essentially think of this

142
00:09:15,920 --> 00:09:17,460
as a bunch of ones and zeros.

143
00:09:17,480 --> 00:09:19,580
It's not quite like that if you were to actually open this up.

144
00:09:19,820 --> 00:09:20,980
But that's essentially the idea.

145
00:09:20,990 --> 00:09:26,450
This is not something you want to open up and edit because the raw data files being stored in the database,

146
00:09:26,450 --> 00:09:31,460
so you can't really interact with this file in the same way you can with others, but just keep that

147
00:09:31,460 --> 00:09:31,770
in mind.

148
00:09:31,790 --> 00:09:36,100
It is now created for us by the fact that we ran that migrate command.

149
00:09:36,110 --> 00:09:40,730
It looks at the installed apps inside the settings and creates any necessary database tables.

150
00:09:41,180 --> 00:09:47,870
So what we want to then do is be able to create our own models and then we would have to make sure that

151
00:09:47,870 --> 00:09:52,310
that's registered underneath the installed apps so that we run this again.

152
00:09:52,310 --> 00:09:54,470
We can actually create those additional tables.

153
00:09:54,680 --> 00:09:59,750
So with that being said, let's open up office and open up models that pie.

154
00:10:00,500 --> 00:10:06,380
So underneath my site office models that pie, I have my very first models that pie file that I'm going

155
00:10:06,380 --> 00:10:07,610
to play around with.

156
00:10:08,150 --> 00:10:09,980
So how do we actually create a model?

157
00:10:10,460 --> 00:10:15,830
We use a class call and then whatever you want to call your model.

158
00:10:15,950 --> 00:10:19,340
So again, these concepts are represented by Python classes.

159
00:10:19,340 --> 00:10:24,200
But really, what's going on behind the scenes is each of these models is representing a table.

160
00:10:24,440 --> 00:10:30,890
And then each field or attribute inside that model is then representing some sort of column inside that

161
00:10:30,890 --> 00:10:31,280
table.

162
00:10:31,790 --> 00:10:35,420
So we say class and I'm going to call this patient.

163
00:10:36,580 --> 00:10:40,090
And then we inherits from models that model.

164
00:10:41,320 --> 00:10:46,750
OK, so then it's up to you to decide what columns or attributes should a patient have.

165
00:10:47,080 --> 00:10:52,360
This one's always kind of tricky because you want to try to get as much right as you can upfront, but

166
00:10:52,360 --> 00:10:54,400
there's always going to be changes into the future.

167
00:10:54,430 --> 00:10:56,330
So luckily, Django is flexible on that.

168
00:10:56,350 --> 00:11:01,240
You can add more columns later on, but you always want to try to get as much information as possible

169
00:11:01,390 --> 00:11:04,600
at the very beginning of your project, even if you don't end up collecting it.

170
00:11:04,810 --> 00:11:07,030
So what does a patient have?

171
00:11:07,060 --> 00:11:10,410
Well, we know a patient has a name and a first name or last name, et cetera.

172
00:11:10,900 --> 00:11:13,300
So what we could do is say, I want a first name.

173
00:11:14,270 --> 00:11:18,200
And then off of models, we end up having to call the actual field.

174
00:11:18,590 --> 00:11:23,030
So there are many different types of fields, and this is another one where you just need a little bit

175
00:11:23,030 --> 00:11:29,180
of experience to figure out what are the fields that are available for us, as well as what is the most

176
00:11:29,180 --> 00:11:30,230
appropriate field.

177
00:11:31,140 --> 00:11:37,290
So at this point, I would like to point out that there is a model field reference inside the documentation.

178
00:11:37,650 --> 00:11:39,880
It's under models for its large fields.

179
00:11:39,930 --> 00:11:45,120
Again, you could just Google Django documentation model field reference, but this gives you a list

180
00:11:45,420 --> 00:11:47,340
of all the field options you have.

181
00:11:47,520 --> 00:11:54,000
So you have things like an auto field that's an integer field that automatically increments available

182
00:11:54,000 --> 00:11:55,440
to available IDs.

183
00:11:55,860 --> 00:12:00,050
Then there's big auto field, so that's much larger integers big integer field.

184
00:12:00,070 --> 00:12:03,930
So if you have really large numbers that you want to store, that could be useful.

185
00:12:03,930 --> 00:12:06,030
Binary fields zero one.

186
00:12:06,420 --> 00:12:08,970
Some of the most common ones are the character field.

187
00:12:09,040 --> 00:12:10,860
So as you can imagine, this is for strings.

188
00:12:11,220 --> 00:12:17,130
And if you would want to use this, then you can check out the extra arguments that specific fields

189
00:12:17,130 --> 00:12:17,400
have.

190
00:12:17,490 --> 00:12:23,940
So, for example, this character field has a maxlength and this is actually required, so you have

191
00:12:23,940 --> 00:12:28,800
to decide what's the maximum length that we want this field to hold.

192
00:12:29,250 --> 00:12:33,600
So he would then have to think, well, what's the maximum length the character's a last name could

193
00:12:33,600 --> 00:12:33,960
have?

194
00:12:34,440 --> 00:12:38,970
So again, maxlength is actually being enforced at the database level, and this is the sort of thing

195
00:12:38,970 --> 00:12:41,220
that you really want to try to get right at the beginning.

196
00:12:41,220 --> 00:12:45,750
So if you ever have any doubt, probably go larger than smaller, you don't want to accidentally put

197
00:12:45,990 --> 00:12:48,990
a max length of two letters for the last name.

198
00:12:48,990 --> 00:12:52,260
And then obviously someone comes in the last name Smith, and you're kind of screwed.

199
00:12:52,470 --> 00:12:57,150
You have to go back run migrations, expand that constraint, etc. So these are the kind of things I

200
00:12:57,150 --> 00:13:00,150
want to be careful of and try to think as far ahead into the future as you can.

201
00:13:00,450 --> 00:13:03,690
Obviously, this is always easier said than done, but it's just something to keep in mind.

202
00:13:04,200 --> 00:13:07,800
So clearly we have things like character field, which are relevant for strings.

203
00:13:08,010 --> 00:13:12,600
We have things like date fields that'll be useful if we want to set up an appointment time, register

204
00:13:12,720 --> 00:13:14,390
their last appointment, we could do that.

205
00:13:14,400 --> 00:13:20,190
There's also ways to use auto now, which would automatically create a timestamp of the current time.

206
00:13:20,340 --> 00:13:21,330
Maybe a button is clicked.

207
00:13:21,570 --> 00:13:22,970
So those things are super useful.

208
00:13:22,980 --> 00:13:26,350
A lot of this comes just right out of the box ready for you to use.

209
00:13:26,400 --> 00:13:30,570
And then for ages, we're probably going to want to use some some sort of integer based field.

210
00:13:30,690 --> 00:13:35,550
So there should be an integer field so we can see here integer field.

211
00:13:35,940 --> 00:13:40,980
Also note that there's the ability to only have a set limit of choices with integers, but more on that

212
00:13:40,980 --> 00:13:43,410
later when we actually talk about interacting of this.

213
00:13:43,830 --> 00:13:49,560
But right now, we're just going to set up the kind of simplest integer field, which is just that integer

214
00:13:49,560 --> 00:13:49,950
field.

215
00:13:50,280 --> 00:13:52,710
You can also have a minimum value and maximum value.

216
00:13:53,070 --> 00:13:58,560
So if we start thinking about ages, maybe we want a minimum value age to be like one years old or zero

217
00:13:58,560 --> 00:14:01,290
years old and a maximum value to be like 120 years old.

218
00:14:01,650 --> 00:14:04,590
That way, someone can accidentally put that there a thousand years old.

219
00:14:05,430 --> 00:14:05,730
OK.

220
00:14:06,030 --> 00:14:10,020
So there are a lot of different things that we can do here, but we're just going to keep it as simple

221
00:14:10,020 --> 00:14:12,780
as possible in order to just understand the basics.

222
00:14:12,810 --> 00:14:13,830
Let me close this off.

223
00:14:15,100 --> 00:14:21,910
OK, so we're going to create a character field for this model first name attribute and for character

224
00:14:21,910 --> 00:14:24,220
fields, we do have to define a maximum length.

225
00:14:24,760 --> 00:14:26,620
I want to set the sequel to 30 characters.

226
00:14:26,920 --> 00:14:29,260
It's up to you if you want to make this longer or shorter.

227
00:14:29,560 --> 00:14:33,730
Obviously, as I keep mentioning, probably go more on the longer side just for future proof purposes.

228
00:14:34,270 --> 00:14:39,460
Now we're going to say last name is equal to models that character field.

229
00:14:40,330 --> 00:14:45,790
And let's also have this be a maximum length of 30, then let's imagine we also want to keep track of

230
00:14:45,790 --> 00:14:46,720
the patient's age.

231
00:14:47,440 --> 00:14:48,920
That's going to be equal to models.

232
00:14:48,940 --> 00:14:51,730
Then we have to think, Well, what's a relevant field for an age?

233
00:14:52,090 --> 00:14:54,900
Maybe integers are OK for thinking of age in years.

234
00:14:54,910 --> 00:14:58,250
You kind of don't say someone is three point five four.

235
00:14:58,270 --> 00:15:03,340
As far as years and age, so saying something like three years old or four years old, probably totally

236
00:15:03,340 --> 00:15:03,710
fine.

237
00:15:03,730 --> 00:15:07,090
So we'll say into your field and I'll just leave the defaults there later.

238
00:15:07,540 --> 00:15:12,850
Now I did mention we will have the ability to add in constraints or validation factors.

239
00:15:13,150 --> 00:15:18,130
For instance, maybe we want to make sure that the age is in between a range of zero and 100.

240
00:15:18,430 --> 00:15:22,750
That way, there's no accidental typos where someone accidentally puts an extra zero on, say, someone's

241
00:15:22,750 --> 00:15:23,800
a thousand years old.

242
00:15:24,190 --> 00:15:24,970
How will we do that?

243
00:15:25,090 --> 00:15:28,960
Well, later on, we're going to learn about something called validators, and there's a bunch of built

244
00:15:28,960 --> 00:15:30,690
in validators that are super useful.

245
00:15:30,700 --> 00:15:35,530
And what you end up doing is you essentially add them to the fields while you're building out your model.

246
00:15:35,770 --> 00:15:41,080
For example, here's a custom validation field for Validate even, which is actually saying, Hey,

247
00:15:41,230 --> 00:15:42,520
the number of Puddin has to be.

248
00:15:42,520 --> 00:15:47,920
Even now, that's a little specific, but we can see there's a bunch of value validators that are useful

249
00:15:47,920 --> 00:15:48,320
to us.

250
00:15:48,340 --> 00:15:54,070
For example, a minimum value, any maximum value that would be really useful for something like age.

251
00:15:54,400 --> 00:16:00,010
We're going to introduce validation later on because it has more to do with user input and then making

252
00:16:00,010 --> 00:16:02,050
sure that that user input is correct.

253
00:16:02,050 --> 00:16:06,430
And if not, it throws an error to the client user and then they can fix their error.

254
00:16:07,210 --> 00:16:11,530
There's also a bunch of really useful validators, like an email validator to make sure this is an actual

255
00:16:11,530 --> 00:16:12,310
email address.

256
00:16:12,610 --> 00:16:14,260
OK, so more on that later.

257
00:16:14,260 --> 00:16:17,200
But just keep that in mind that that will eventually come into play here.

258
00:16:17,530 --> 00:16:20,080
But we want to keep things simple, so I'm just going to save those changes.

259
00:16:20,230 --> 00:16:21,520
So what have we done so far?

260
00:16:21,820 --> 00:16:27,370
Well, I've created a model and it has attributes which eventually I want to make sure that this model

261
00:16:27,370 --> 00:16:28,840
is within my database.

262
00:16:29,170 --> 00:16:34,660
But right now, we haven't actually connected this model to the database, so we need to run migrations

263
00:16:34,660 --> 00:16:37,120
again and actually make migrations.

264
00:16:37,120 --> 00:16:41,050
But that involves us connecting the application to the settings that pie.

265
00:16:41,440 --> 00:16:44,170
Let's take that into consideration in the next lecture.

266
00:16:44,440 --> 00:16:45,010
I'll see you there.

