1 00:00:00,620 --> 00:00:05,620 Before test our project, let’s doing some fix in our project. 2 00:00:06,860 --> 00:00:14,520 Here we have a navbar, but the link is still not work. Let’s make this link work. 3 00:00:14,760 --> 00:00:16,960 Open the visual studio code. 4 00:00:17,160 --> 00:00:24,540 First, we need to edit urls.py file. We need to put a name for each url. 5 00:00:24,620 --> 00:00:39,280 Let’s set the name of devices url to devices, configure url to configure, verify_config url to verify_config, 6 00:00:44,060 --> 00:00:46,580 and log url to log. 7 00:00:51,480 --> 00:00:58,460 Next, let’s edit the template where we put navbar script. Which is base.html. 8 00:00:58,860 --> 00:01:06,740 Here we can see some link, We have home link here, if we see in the browser, we have home. 9 00:01:06,740 --> 00:01:09,480 Let’s edit the url for home. 10 00:01:11,880 --> 00:01:18,200 But before that, if we see here, we don’t have a name for the home url yet. 11 00:01:18,200 --> 00:01:20,480 Let’s set the name first. 12 00:01:25,260 --> 00:01:31,500 Okay. Let’s back to base.hmtl, here let’s define the url. 13 00:01:31,740 --> 00:01:37,720 Here we put the name of the url that we have set in the urls.py file. 14 00:01:40,240 --> 00:01:43,800 Next, let’s edit the url for Device List. 15 00:01:59,100 --> 00:02:02,120 Let’s copy this script for other url 16 00:02:02,680 --> 00:02:05,220 Let’s change this to Configure. 17 00:02:15,520 --> 00:02:18,440 We don’t need disable class here. 18 00:02:23,020 --> 00:02:25,480 Let’s copy the configure link, 19 00:02:26,700 --> 00:02:33,020 paste for verify_config, and paste again for log. 20 00:02:33,680 --> 00:02:36,620 Let’s change this to verify config, 21 00:02:42,820 --> 00:02:45,320 and change this to log. 22 00:02:49,380 --> 00:02:59,020 Now let’s back to the browser, refresh. Now let’s try the link. Go to home, 23 00:02:59,420 --> 00:03:01,420 go to device list. 24 00:03:04,780 --> 00:03:06,980 Go to configure, 25 00:03:08,260 --> 00:03:14,200 go to verify config, and finally go to log. 26 00:03:16,760 --> 00:03:20,940 Okay now our navbar is working perfectly! 27 00:03:21,460 --> 00:03:27,980 Next, if we see in the home page, we have a last event here. But the data in the last 28 00:03:27,980 --> 00:03:30,660 event is still dummy data. 29 00:03:30,940 --> 00:03:35,500 Let’s edit this to show last 10 event from the database. 30 00:03:35,880 --> 00:03:41,980 Open the visual studio code. Edit home function in the views.py. 31 00:03:46,040 --> 00:03:47,840 Let’s create a new variable 32 00:03:47,840 --> 00:03:51,640 to save the last 10 data from log database. 33 00:04:05,600 --> 00:04:10,680 Here we use order_by -id, means we doing a 34 00:04:10,680 --> 00:04:19,580 reverse order, so we will get the new data. And here we filter to get only 10 data. 35 00:04:20,660 --> 00:04:24,400 Next we need to add this variable to the context. 36 00:04:32,380 --> 00:04:38,160 Okay, we have done here. Now let’s edit home.html. 37 00:04:42,240 --> 00:04:44,780 Here we can remove this. 38 00:04:47,360 --> 00:04:51,520 Then we need to doing a looping to the last_event. 39 00:05:02,220 --> 00:05:04,900 Don’t forget to put endfor. 40 00:05:08,500 --> 00:05:10,620 We can just remove this 41 00:05:12,860 --> 00:05:15,400 Let’s put target in here. 42 00:05:21,100 --> 00:05:23,060 This is the action, 43 00:05:26,780 --> 00:05:28,840 and this is the status. 44 00:05:30,540 --> 00:05:33,480 Finally let’s put the time here. 45 00:05:37,560 --> 00:05:39,700 Let’s back to the browser 46 00:05:42,880 --> 00:05:44,540 Go to home menu. 47 00:05:44,800 --> 00:05:49,080 And here we can see that we don’t have any last event. 48 00:05:49,320 --> 00:05:52,480 This is because we don’t have any action yet. 49 00:05:52,580 --> 00:05:58,020 Okay, this is the end of this video. Now our project is done! 50 00:05:58,020 --> 00:06:02,160 In the next video, we are going to test our application!