WEBVTT

00:01.250 --> 00:04.520
Okay, this is an update to Django five.

00:04.520 --> 00:11.570
When I recorded this section, the Django five wasn't available, so this is me recording after that.

00:11.630 --> 00:13.400
What are the differences?

00:13.430 --> 00:18.650
Basically, you could do almost everything what we've done in this tutorial, but there are a few things

00:18.650 --> 00:25.340
that has been changed in the Django, and this is adjusting to the newest version of the Django, which

00:25.340 --> 00:28.550
is version five at the moment of recording this video.

00:28.580 --> 00:35.540
So when you run the server and if you don't do the same thing as we've done it in our tutorial, then

00:35.540 --> 00:36.650
you might see this warning.

00:36.650 --> 00:39.140
This is actually just a warning, so it's not an error.

00:39.140 --> 00:45.800
So you can still run your application without any problems, but it's basically telling you that a autocreate

00:45.800 --> 00:50.090
the primary key are used not defining in a primary key type.

00:50.120 --> 00:59.570
So what is that means is when we use a ID auto primary key, then Django doesn't really know which one

00:59.570 --> 01:00.050
to use.

01:00.050 --> 01:06.840
So we could basically this is for for the models like when we have movie, then ID will be automatically

01:06.870 --> 01:07.410
added.

01:07.410 --> 01:12.510
So what we could do is we could tell a Django which one to use.

01:12.510 --> 01:19.890
So I can go to settings and anywhere really in the in the settings I can go for example here I can do

01:19.890 --> 01:20.130
this.

01:20.130 --> 01:23.220
So we need to specify default out of field.

01:23.760 --> 01:25.230
That will be equal.

01:25.230 --> 01:27.000
And I will do quotes here.

01:27.000 --> 01:30.420
And then I can specify out of field will be used.

01:30.420 --> 01:31.710
So like that.

01:31.710 --> 01:37.260
So that means in the settings I will say this is auto field and its coming from the model auto field.

01:37.260 --> 01:39.930
And if I will save it and refresh it now.

01:44.340 --> 01:46.770
You see this warning is gone.

01:46.770 --> 01:50.730
So thats one thing that we can actually fix to add this.

01:50.730 --> 01:56.970
Another thing is that it's not actually telling here, but it's something that has been removed from

01:56.970 --> 01:59.490
Django five, which is this index together.

01:59.490 --> 02:02.730
So we could either remove it completely if we don't need it.

02:02.730 --> 02:09.190
But if you for some reason wants to have that, what we can do is we can actually change it.

02:09.190 --> 02:11.530
So I will do indexes.

02:11.530 --> 02:14.710
So this is the new way how we actually do this.

02:14.710 --> 02:16.030
So I will remove it from now.

02:16.030 --> 02:22.600
So this will be index s is equal to square brackets.

02:22.600 --> 02:25.840
And then we do models index.

02:27.100 --> 02:33.370
And then we can do here field equal to.

02:33.400 --> 02:36.040
And then here we will have an array.

02:36.070 --> 02:38.680
So basically we can say like that.

02:38.680 --> 02:41.050
So this will be our array like this.

02:41.050 --> 02:44.410
So we don't use the indexes to get anymore.

02:44.410 --> 02:45.730
We do indexes.

02:45.730 --> 02:46.840
That is array.

02:46.870 --> 02:50.230
We'll do models index fields user and movie.

02:50.260 --> 02:56.860
So if I'll refresh it now nothing's actually been changed.

02:56.860 --> 03:01.630
But this is the previous method of this was deprecated in the newest version.

03:01.630 --> 03:07.060
So pretty much if you will do this adjustment, all the rest of the things stays the same and they are

03:07.420 --> 03:09.460
the current Django version.
