In our previous lesson we just finished creating two model courses for the game.
In this lesson we went.
We want to start adding codes to the server P file.
We want to import the model course.
We just made so set import drone app models.
Course in this case I use the full path.
You can also import using from the way it is always easier to understand where things are imported from
when you use the full path.
We want to add some codes right below the video generator so let me add some blank lines so you can
see the codes better.
First let's define a function called Get course and set the course i.e. to none.
Let's set variable drone to get drone then Set Variable courses with drone app models.
Course get courses with drone as the argument so we can get the course.
If the course idea exists we set to return courses get with the course I.D. if the course I.D. doesn't
exist we return of course a and b.
Next we need to make a page where we can choose which course to play.
So set a decorator app route to slash games slash shake.
Now let's define game shake function.
Variable courses will be set to get courses to get the course.
Then we return render template set to games slash shake HMO which we all be creating later on followed
by argument courses set to courses.
Let's go on to set the HMO.
Go to the project tab and right click on templates choose new and click on directory.
Set the directory name to games and hit.
OK now right click on the Games folder and choose new click on HDMI mail file and set the file name
to shake and hit OK.
Once you created the shake file open the file and we will be creating the template.
Clear the original codes as we've done with our other H Jamal files.
We will extend the layout.
Next we set block content and the very bottom will be and block under the block content.
We will be setting the contents.
Let's start with the title.
Begin with div.
Set a line to center.
Next row.
Set an H tag shake as the title then div I.D. to result in this result.
We will see that you lapse time.
Next we will be using the J query mobile code type field set followed by data rule and set to control
group in the field set.
We will be setting the course names so we start a for loop with I.D. followed by a course in courses.
Items to get both courses not to forget to close the loop with N for then we set input type to radio
and the name will be caustic.
Ideas will be radio choice IV V and two curly braces I.D..
This will be replaced by the course ideas.
Lastly we set a in the end.
Then the value will also be two curly braces with I.D. the label will be set to 4 equals radio choice
v I.D. A with two curly braces with coarse name as we created two courses.
Let's set a default check on the first course we can set.
If statement.
If I.D. is one we set a check.
Then we set to end.
If once you've finished all these codes I want you to go to the index GMO
in our previous lesson we set the controller link.
Here we need to add the new link games Sheikh and the linked name will be Sheik game as we complete
the front end.
Let's run this code to see how it works.
Once we run the code click on the euro RL In our top page you can see that the shaking button has been
added so let's click on Shake game in the shape game site you will see the two courses click on either
course name to see if the radio button is working.
Great job.
I'll see you in the next lesson.