1
00:00:01,010 --> 00:00:05,820
In our previous lesson we just finished creating two model courses for the game.

2
00:00:06,190 --> 00:00:07,650
In this lesson we went.

3
00:00:07,840 --> 00:00:11,860
We want to start adding codes to the server P file.

4
00:00:12,100 --> 00:00:13,890
We want to import the model course.

5
00:00:13,900 --> 00:00:18,400
We just made so set import drone app models.

6
00:00:18,400 --> 00:00:22,330
Course in this case I use the full path.

7
00:00:22,330 --> 00:00:29,080
You can also import using from the way it is always easier to understand where things are imported from

8
00:00:29,290 --> 00:00:31,720
when you use the full path.

9
00:00:31,760 --> 00:00:37,850
We want to add some codes right below the video generator so let me add some blank lines so you can

10
00:00:37,850 --> 00:00:39,260
see the codes better.

11
00:00:39,290 --> 00:00:44,100
First let's define a function called Get course and set the course i.e. to none.

12
00:00:45,800 --> 00:00:53,480
Let's set variable drone to get drone then Set Variable courses with drone app models.

13
00:00:53,490 --> 00:00:58,720
Course get courses with drone as the argument so we can get the course.

14
00:00:58,940 --> 00:01:06,980
If the course idea exists we set to return courses get with the course I.D. if the course I.D. doesn't

15
00:01:07,040 --> 00:01:11,330
exist we return of course a and b.

16
00:01:11,330 --> 00:01:15,450
Next we need to make a page where we can choose which course to play.

17
00:01:15,920 --> 00:01:20,980
So set a decorator app route to slash games slash shake.

18
00:01:21,020 --> 00:01:24,090
Now let's define game shake function.

19
00:01:24,350 --> 00:01:30,140
Variable courses will be set to get courses to get the course.

20
00:01:30,650 --> 00:01:39,020
Then we return render template set to games slash shake HMO which we all be creating later on followed

21
00:01:39,020 --> 00:01:42,850
by argument courses set to courses.

22
00:01:42,950 --> 00:01:46,990
Let's go on to set the HMO.

23
00:01:47,000 --> 00:01:54,090
Go to the project tab and right click on templates choose new and click on directory.

24
00:01:54,380 --> 00:01:56,820
Set the directory name to games and hit.

25
00:01:56,840 --> 00:02:06,530
OK now right click on the Games folder and choose new click on HDMI mail file and set the file name

26
00:02:06,530 --> 00:02:09,170
to shake and hit OK.

27
00:02:09,920 --> 00:02:15,870
Once you created the shake file open the file and we will be creating the template.

28
00:02:16,190 --> 00:02:21,110
Clear the original codes as we've done with our other H Jamal files.

29
00:02:21,200 --> 00:02:23,590
We will extend the layout.

30
00:02:23,720 --> 00:02:31,620
Next we set block content and the very bottom will be and block under the block content.

31
00:02:31,640 --> 00:02:34,500
We will be setting the contents.

32
00:02:34,580 --> 00:02:36,280
Let's start with the title.

33
00:02:36,290 --> 00:02:37,770
Begin with div.

34
00:02:37,850 --> 00:02:40,310
Set a line to center.

35
00:02:40,310 --> 00:02:41,000
Next row.

36
00:02:41,000 --> 00:02:48,400
Set an H tag shake as the title then div I.D. to result in this result.

37
00:02:48,410 --> 00:02:52,450
We will see that you lapse time.

38
00:02:52,720 --> 00:03:00,130
Next we will be using the J query mobile code type field set followed by data rule and set to control

39
00:03:00,130 --> 00:03:02,500
group in the field set.

40
00:03:02,530 --> 00:03:11,030
We will be setting the course names so we start a for loop with I.D. followed by a course in courses.

41
00:03:11,290 --> 00:03:21,980
Items to get both courses not to forget to close the loop with N for then we set input type to radio

42
00:03:22,070 --> 00:03:24,480
and the name will be caustic.

43
00:03:25,010 --> 00:03:31,920
Ideas will be radio choice IV V and two curly braces I.D..

44
00:03:32,240 --> 00:03:35,210
This will be replaced by the course ideas.

45
00:03:35,210 --> 00:03:38,990
Lastly we set a in the end.

46
00:03:38,990 --> 00:03:47,720
Then the value will also be two curly braces with I.D. the label will be set to 4 equals radio choice

47
00:03:47,840 --> 00:03:56,420
v I.D. A with two curly braces with coarse name as we created two courses.

48
00:03:56,420 --> 00:04:01,210
Let's set a default check on the first course we can set.

49
00:04:01,220 --> 00:04:02,590
If statement.

50
00:04:02,840 --> 00:04:05,480
If I.D. is one we set a check.

51
00:04:06,260 --> 00:04:07,570
Then we set to end.

52
00:04:07,570 --> 00:04:13,760
If once you've finished all these codes I want you to go to the index GMO

53
00:04:17,060 --> 00:04:20,220
in our previous lesson we set the controller link.

54
00:04:20,450 --> 00:04:28,700
Here we need to add the new link games Sheikh and the linked name will be Sheik game as we complete

55
00:04:28,760 --> 00:04:29,880
the front end.

56
00:04:29,930 --> 00:04:32,780
Let's run this code to see how it works.

57
00:04:33,140 --> 00:04:40,430
Once we run the code click on the euro RL In our top page you can see that the shaking button has been

58
00:04:40,430 --> 00:04:49,040
added so let's click on Shake game in the shape game site you will see the two courses click on either

59
00:04:49,040 --> 00:04:52,760
course name to see if the radio button is working.

60
00:04:52,760 --> 00:04:53,770
Great job.

61
00:04:53,840 --> 00:04:55,040
I'll see you in the next lesson.
