WEBVTT 00:00.390 --> 00:03.350 So awesome that we're able to show completed to DOS. 00:03.390 --> 00:06.900 But let's go ahead and look at what other things we'd like to be able to do. 00:07.290 --> 00:11.880 So I'm going to move back to my project, to the Urals, that pie for the whole project. 00:12.510 --> 00:17.180 And I'm going to say, OK, I would like to be able to see the current to DOS. 00:17.220 --> 00:21.720 And I also would like the ability to be able to create or generate one. 00:21.730 --> 00:26.490 So let's use one of those, you know, list creates where we can both list out all the to DOS. 00:26.490 --> 00:31.350 In our case, we're going to list out the current to DOS and then also allow someone to create a new 00:31.350 --> 00:32.340 to do object. 00:32.610 --> 00:39.890 So with that, let's go ahead and move over to our you URLs dot pi for the API and add this New York 00:39.890 --> 00:41.160 URL that we're looking for. 00:41.760 --> 00:44.590 So in this case, we're just going to call it to do so. 00:44.590 --> 00:46.140 Going to copy what we have here. 00:47.240 --> 00:55.010 I'm going to pace this and I'm going to say just simply to DOS, and we need to have a new class that 00:55.010 --> 00:55.810 we're looking for here. 00:55.820 --> 01:00.900 So let's go ahead and move over to the used up pie here inside of our API. 01:01.850 --> 01:03.790 And we want to do a new class again. 01:03.830 --> 01:08.990 I think this should be listing out things and allow people to also create. 01:09.890 --> 01:13.070 So let's go ahead and copy the class that we have here. 01:13.070 --> 01:19.130 We're gonna be reusing a lot of this, but paste this down below and I'm going to call this the to do 01:19.310 --> 01:20.990 create list. 01:21.360 --> 01:26.520 And instead of just the list API, we're gonna call this list, create API. 01:26.570 --> 01:28.130 Let's let's have that be consistent. 01:28.140 --> 01:31.460 Let's call this to do list create here. 01:31.660 --> 01:31.840 OK. 01:32.240 --> 01:34.090 So that's looking all good there. 01:34.880 --> 01:36.860 We're still using to do serializer. 01:36.890 --> 01:39.590 We want to make sure that someone is authenticated. 01:39.620 --> 01:45.310 In this case, we want to make sure that the instead of the date completed is no. 01:45.350 --> 01:50.510 We want this to be true to say, you know, these are things that have not been completed yet. 01:51.190 --> 01:54.180 And we don't need to have the ordered by date completed. 01:54.200 --> 01:57.050 Instead, let's go ahead and get from our to do here. 01:57.060 --> 02:04.910 If someone were to get all of the to dos the current tattoos, I think it by default is naturally list 02:04.910 --> 02:05.990 them out from when they're created. 02:06.020 --> 02:07.070 So we don't need to do that. 02:07.730 --> 02:09.530 But it's really just the true there. 02:09.650 --> 02:15.070 So let's go ahead and move back and we can cut what we have there. 02:16.040 --> 02:16.520 Great. 02:16.970 --> 02:21.350 And really, the only thing that we need to do is add a little bit of special code when someone wants 02:21.350 --> 02:23.530 to create a to do object. 02:23.540 --> 02:28.520 And that's that we have to, you know, specify what user it is that this is going to be assigned to. 02:28.880 --> 02:33.230 So let's go ahead and do a def perform, underscore, create. 02:34.190 --> 02:34.410 OK. 02:34.460 --> 02:37.580 And let's go ahead and pass self into there. 02:38.180 --> 02:42.920 And like I said, the big thing that we want to do here is we want to take our serializer. 02:43.400 --> 02:45.980 And I forget that's also something passed inside here. 02:45.980 --> 02:48.800 So we have self and serializer. 02:50.040 --> 02:57.810 OK, so now we're going to take our serializer dot save and inside of this save. 02:57.840 --> 03:05.310 We want to make sure that we say user is equal to the self dot request dot user. 03:05.970 --> 03:06.180 OK. 03:06.900 --> 03:14.340 So really, that's all it takes to implement listing out current to DOS and also creating one. 03:14.370 --> 03:16.810 This is why I love the jingle risk framework. 03:17.040 --> 03:18.580 So I'm gonna save this fused up high. 03:18.960 --> 03:21.390 I'm also going to save this you URL's file here. 03:21.810 --> 03:23.250 Let's go back to the Web site. 03:23.610 --> 03:27.030 So let's go to API slash to DOS, OK. 03:27.090 --> 03:27.960 Once we're here. 03:29.030 --> 03:29.200 Oh. 03:30.490 --> 03:36.700 I think we have not switched that boolean because that let's go back to the views here. 03:38.200 --> 03:41.100 The date completed is not true. 03:41.650 --> 03:43.270 Yeah, that should be different there. 03:45.120 --> 03:45.960 This is what it is. 03:46.020 --> 03:47.910 We created this name of this class. 03:48.240 --> 03:51.510 Forgot to put it into your LS here, so let's go ahead and paste that in. 03:51.630 --> 03:54.570 Save this should be looking a lot better this time. 03:54.570 --> 03:57.060 Let's hit enter and look at that. 03:57.240 --> 03:59.550 We have listed out the one current to do that. 03:59.550 --> 04:06.270 We have add an API to my site and you know, maybe the next thing we want to do is try adding it to 04:06.270 --> 04:06.450 do. 04:06.450 --> 04:11.070 And I think in the site, the thing that we should be adding next is the ability to, you know, you 04:11.070 --> 04:13.370 know, update, delete those sorts of things. 04:13.380 --> 04:17.910 So I'm going to say add update and delete here. 04:18.190 --> 04:20.370 OK, so Memmo. 04:21.420 --> 04:22.440 Hopefully. 04:24.030 --> 04:25.800 Not too hard. 04:25.830 --> 04:27.780 And this is a pretty important part of our Web site. 04:27.840 --> 04:28.890 We're going to check that box. 04:28.950 --> 04:31.590 I'm going to hit post and this is so cool. 04:31.890 --> 04:33.360 It says this was successful. 04:33.370 --> 04:37.350 And if I go back and I just want to see all the to dos here. 04:37.350 --> 04:40.500 So let's go ahead and go back to just two dos. 04:40.860 --> 04:41.580 Look at this. 04:41.730 --> 04:42.710 They're listed out here. 04:42.720 --> 04:45.690 There's add an API to my site, which we already had. 04:45.720 --> 04:48.870 And then also this new add update and delete. 04:49.320 --> 04:54.030 And again, what I just love about this is if I go to my current project and look at my current things, 04:54.330 --> 04:55.530 both of those things are there. 04:55.530 --> 04:59.400 Like the API is a living version of this Web site. 04:59.940 --> 05:00.630 So exciting. 05:01.020 --> 05:02.520 Well, we're on such a roll here. 05:02.550 --> 05:06.870 Let's just go ahead and keep moving and add this functionality that we made a to do for. 05:07.110 --> 05:11.040 Let's make it so that a user can update and delete a to do object. 05:11.160 --> 05:15.960 So let's go ahead and move back to our project into the Urals dot pie for our API. 05:16.080 --> 05:17.610 And let's add a new one here. 05:17.970 --> 05:23.610 And this is going to be for someone, again, to view a current to do or update it, delete it, whatever 05:23.610 --> 05:24.810 it is that they'd like to do. 05:25.050 --> 05:30.420 So let's go ahead and copy and paste what we have from one of our existing ads. 05:30.510 --> 05:32.730 But say this is going to be to do slash. 05:33.180 --> 05:38.220 And then when someone provides the primary key for that to do object. 05:38.250 --> 05:43.080 So we're going to say here that we're looking for an INT and we'll give it the name of P.K. Piqué for 05:43.080 --> 05:43.950 primary key. 05:44.580 --> 05:50.280 And then we're gonna go ahead, move over to our Vieuxtemps pie and create this new class based view. 05:50.490 --> 05:53.220 So we've got to come up with some name here. 05:53.220 --> 05:58.020 I'm going to go ahead and copy what we have for an existing. 05:59.620 --> 06:00.010 To do. 06:00.040 --> 06:02.140 Let's do this to complete list. 06:02.170 --> 06:03.460 So I got a copy this. 06:04.510 --> 06:06.950 And let's paces all the way down here. 06:07.490 --> 06:07.720 OK? 06:08.300 --> 06:13.720 So the generic that we're gonna be using in this case is the retrieve update destroyed. 06:13.820 --> 06:16.940 This is sort of the the big, powerful, powerful one here. 06:16.940 --> 06:19.100 So I got to do my retrieve. 06:22.000 --> 06:22.660 Update. 06:24.340 --> 06:26.620 Destroy covers. 06:26.800 --> 06:27.800 Haul the basics there. 06:27.820 --> 06:33.810 Let's use this same name that we have here so we have to do retrieve, update, destroy. 06:33.850 --> 06:35.650 Let's get rid of API view there, Kay. 06:36.190 --> 06:38.230 So we're still using that to do serializer. 06:38.260 --> 06:40.330 We're still going to make sure that someone signed in for this. 06:40.360 --> 06:43.150 We still need the same query set, except with this one. 06:43.660 --> 06:44.950 We're gonna be very simple here. 06:45.010 --> 06:48.140 We're just gonna say this is going to work for any to do object. 06:48.160 --> 06:50.210 We just want to make sure that it's for the proper user. 06:50.230 --> 06:53.680 We don't need to do any ordering because we're only getting one thing back. 06:53.710 --> 06:54.820 This is literally it. 06:55.030 --> 06:58.900 So with this in place, let's copy this new name that we have here. 06:59.380 --> 07:05.530 Save this Vieux file, come back to our Urals and say, you know, hey, if someone comes to this particular, 07:05.530 --> 07:07.720 you are ellson them to that view class. 07:08.320 --> 07:11.300 Then with that saved, let's go back to our Web site. 07:11.980 --> 07:14.080 And I'm going to move to the API view here. 07:14.080 --> 07:15.880 So we're going to list out all the tattoos. 07:15.880 --> 07:20.860 And look, we just implemented the functionality for this particular to do the idea for. 07:20.980 --> 07:22.930 So let's go to our API. 07:24.260 --> 07:25.450 Slash four. 07:26.270 --> 07:30.800 And oh, we want API slash to dos slash four. 07:31.670 --> 07:32.200 There we go. 07:32.690 --> 07:34.460 And here we can see all the details for this. 07:34.880 --> 07:37.640 So let's say, you know, I have add, update and delete. 07:37.670 --> 07:43.230 Also, I wanted to say add view, update and delete K. 07:43.340 --> 07:44.560 So if I do this, I can do it. 07:44.600 --> 07:45.020 Put. 07:45.200 --> 07:46.790 And it's going to save that information. 07:46.850 --> 07:48.020 Now it's updated there. 07:48.500 --> 07:49.610 We're currently viewing it. 07:49.670 --> 07:53.120 And we have the ability to delete it here. 07:53.450 --> 07:59.570 Now I'm going to go ahead and copy the title of this one because once we delete it, it's not the same 07:59.570 --> 08:00.290 as completing it. 08:00.310 --> 08:04.520 So I'm going to go ahead and hit the delete here to just show you that if we do this, it really is 08:04.520 --> 08:05.030 gone. 08:05.360 --> 08:11.210 And if we go ahead and look back to our list here of the current to DOS, it's no longer there. 08:11.210 --> 08:12.830 It's not inside of our completed. 08:13.010 --> 08:16.150 Like, if we go to our completed here, it's not there either. 08:16.160 --> 08:17.630 It is just deleted. 08:17.770 --> 08:18.130 Right. 08:18.590 --> 08:20.900 Which brings us to a problem here. 08:21.290 --> 08:26.780 And that's that we need to add the ability for someone to complete a to do object. 08:27.080 --> 08:28.380 So I'm going to go ahead and add back. 08:28.400 --> 08:34.280 This to do K so that someone can add, view, update and delete or that's actually not what we want 08:34.280 --> 08:34.840 to do anymore. 08:34.850 --> 08:35.920 We have that functionality. 08:35.930 --> 08:39.650 It's rather we want to complete a to do. 08:39.940 --> 08:40.270 Okay. 08:40.880 --> 08:44.120 So I'm going to post this and now I have. 08:45.820 --> 08:47.440 These two two items left. 08:47.470 --> 08:49.750 Let's go ahead and cover this one in the next lecture.