WEBVTT 00:02.930 --> 00:05.530 Welcome back in the second part of the lesson. 00:05.540 --> 00:11.330 We're going to learn how to set up a registration at point for our profiles EPA project so that users 00:11.450 --> 00:16.040 are going to be able to create in your accounts the arrest and to do so. 00:16.040 --> 00:23.030 We are now going to install another package called Django author which is a dependency of Django rest 00:23.200 --> 00:25.370 of basically Django stuff. 00:25.400 --> 00:30.680 Use this part of the code that is provided by this package to set up the registration point that will 00:30.680 --> 00:31.850 then go into use. 00:31.850 --> 00:38.630 So you're just going to give the command pip install Django allows the 00:43.120 --> 00:51.490 and I can also update the requirements though the 65 so deep freeze requirements not to 60. 00:51.520 --> 00:52.560 Perfect. 00:52.690 --> 01:01.570 We now need to install the package so yeah I'm going to add a loss. 01:01.940 --> 01:10.220 Then I love that account and all of that. 01:11.100 --> 01:17.950 So shall we need to register all three of them because Django Love is a very powerful package and it 01:17.950 --> 01:24.130 also allows us to provide the social network authentication for Django projects such as for example 01:24.130 --> 01:26.440 using Facebook or Twitter for authentication. 01:26.560 --> 01:31.180 However clearly that's not something that we're going to discuss because it goes well beyond the scope 01:31.180 --> 01:31.840 of the course. 01:32.050 --> 01:35.870 But I'm going to leave you some reference links in the PDA files and the slides. 01:35.920 --> 01:39.340 Therefore I suggest you download them and check them out if you need to. 01:39.340 --> 01:43.600 So we said that the rest of uses Orloff as a dependency. 01:43.960 --> 01:52.300 And specifically it's the rest of DOT registration which uses it this configuration is not finished 01:52.300 --> 01:52.730 yet. 01:52.780 --> 01:58.790 We need to import yet another application this time from Django itself which is Django that contribute 01:58.810 --> 02:04.900 that site down here by the end of a file. 02:04.900 --> 02:19.960 We need to add site I.D. equals one account email verification equals and we can set just not specifically 02:19.980 --> 02:31.510 fire and account email required we can anyway set through clearly as you might have imagined all those 02:31.510 --> 02:32.870 settings. 02:33.130 --> 02:38.080 Because of these apps that we've installed and I actually now see that this is not all law the social 02:38.080 --> 02:43.900 but a all of the social count and we can now give that migrate command. 02:43.990 --> 02:45.790 So I'm just going to open up the terminal. 02:45.790 --> 02:48.280 Once again like so. 02:48.360 --> 02:55.850 So profile CPI Python managed not by my great all the migrations that applied. 02:56.390 --> 03:04.040 We can say now that site administration interface I can just close the third I mean. 03:04.640 --> 03:11.090 Let's go to Chrome and you see that now we've got the accounts application we email addresses but we 03:11.090 --> 03:16.970 also got the site's application which is used by all that software machinery of the package that we've 03:16.970 --> 03:17.620 installed. 03:17.630 --> 03:22.520 We can just forget about it and then we've got the social accounts application you see we've social 03:22.520 --> 03:26.510 accounts social application talks and social applications. 03:26.660 --> 03:32.630 Again we just don't need to think about them because we are actually going to register new accounts 03:32.690 --> 03:33.740 via arrest. 03:33.860 --> 03:37.780 We've another a simple client that we're going to write using requests. 03:37.820 --> 03:42.830 Of course if you want to you can also use a software like for example postman to check all the different 03:42.830 --> 03:46.880 points and in fact you are going to use postmark later on during the course. 03:46.880 --> 03:52.370 However at the moment I think that for the sake of explaining all the new concepts that we are discussing 03:52.520 --> 03:55.410 building the client herself is a much better choice. 03:55.520 --> 04:00.500 But before doing that we actually need to include the registration points. 04:00.590 --> 04:06.080 So basically define the U.S. real end points that we are going to need to actually register new accounts 04:06.080 --> 04:07.140 to be addressed. 04:07.160 --> 04:18.020 So I'm just going to copy this line like so and this is going to be API arrest author registration and 04:18.020 --> 04:22.400 this time we want to include the rest of the registration that you had else. 04:22.890 --> 04:23.150 OK. 04:23.180 --> 04:29.270 So we have now ready to create another file within the client's folder so I can just call it so I can 04:29.780 --> 04:39.350 of test to that by and I can actually just copy all the code we've written in the previous file and 04:39.350 --> 04:42.040 at the moment we're not going to need any of these. 04:43.010 --> 04:46.360 We need however to uncle meant the previous lines. 04:46.540 --> 04:51.800 And so in order to create a new account of course we're going to need a username and password password 04:51.800 --> 04:59.200 configuration and any mail field so I can just call this data and we can do something like this one 04:59.750 --> 05:00.740 too. 05:00.800 --> 05:02.990 This is going to be data. 05:03.260 --> 05:13.340 And so we need user name then we need e-mail we can just set something like test at rest that's com 05:13.790 --> 05:16.800 and these can be just called rest. 05:17.080 --> 05:21.680 Test them ambassador is going to be password one we can just set change me. 05:21.680 --> 05:27.500 One two three and then we're going to need that password confirmation which is going to be called Password 05:27.520 --> 05:28.700 2. 05:28.880 --> 05:34.760 Then of course the end point is going to be different is not the logging endpoint but the registration 05:34.790 --> 05:35.820 and bind. 05:36.050 --> 05:38.540 And do we have no ready to execute the script. 05:38.540 --> 05:40.520 So let's restart the development server 05:43.420 --> 05:44.240 like so. 05:44.440 --> 05:46.660 And you also need a second terminal. 05:47.290 --> 05:50.330 So go and change directory clients. 05:50.590 --> 05:52.570 Let's run a script and let's see what happens. 05:52.600 --> 05:55.810 So Python took enough test to do it by. 05:56.410 --> 05:57.340 Awesome. 05:57.340 --> 06:04.090 We get status code 200 and you see we also get the right away and authentication token for adding new 06:04.180 --> 06:04.800 account. 06:05.110 --> 06:10.660 And it is important to note that we've registered a new account but of course because of the sickness 06:10.690 --> 06:16.450 we've set in the previous lessons we also get a new profile instance associated with it. 06:16.450 --> 06:24.370 So let's go back to site administration and let's check users and edit e's are addressed. 06:24.400 --> 06:30.980 Test user let's check the profiles profiles and entities. 06:31.000 --> 06:35.430 So let's now try to use indication talk and provide it right away. 06:35.880 --> 06:45.760 OK goes to change it to make a get request going to comment this out to the same endpoint that we've 06:45.760 --> 06:49.000 previously used the profiles end point. 06:49.030 --> 06:57.510 So once again let's open this up and let's execute a script and did it is as expected standards go to 06:57.510 --> 06:57.990 Android. 06:58.030 --> 06:58.550 OK. 06:58.570 --> 07:04.000 We get out at least we will the Jasons of the different profiles in our database you see did we also 07:04.000 --> 07:09.880 have the third one we've created rest test with primary key three. 07:09.910 --> 07:10.150 OK. 07:10.180 --> 07:13.670 So that was it for these lectures about the Django rest of the package. 07:13.750 --> 07:18.910 In the next one we are going to see if to set up all the remaining endpoints for our rest api using 07:18.910 --> 07:20.200 view sets and routers.