Making with Code

Exploring Templates #

During the track lessons you will be creating the web app for the ISF Riddler. You should remember the Riddle database from the Networking Unit!

๐Ÿ” You will be primarily focused on learning the Django template language uses and Bootstrap.


[0] Starter Code #

๐ŸŒ Github Repo: github.com/Making-with-Code/lab_riddler_frontend

๐Ÿ’ป Install requirements
poetry install
๐Ÿ’ป Enter the poetry shell.
poetry shell

[1] Model #

๐Ÿ‘€ You can find the Riddle model in riddle_app/models.py. It can be helpful to know the architecture of the model so you know what are you are able to display in the frontend.

๐Ÿ’ป Firstly, let’s migrate our Riddle model into the database. Then, run the server.

python manage.py migrate
python manage.py runserver   `

๐Ÿ’ป Visit 127.0.0.1:8000/ to view the app! As you are in the backend track, the website looks pretty boring…


[2] Explore Templates #

๐Ÿ’ป Open up the files with: code .

๐Ÿ‘€ Explore the templates the: riddle_app/templates directory

๐Ÿ’ป Open the different html files and follow the instructions in the comments. The comments are denoted with a <!-- ๐Ÿ’ป -->

You will need to reference the Django template language documentation to made the necessary additions.

<!-- ๐Ÿ’ป Add the Difficulty for the specific riddle -->

To display the difficulty field in the full label, you will need to reference get_FOO_display() documentation


[2] Customize CSS #

Bootstrap is a massive CSS framework library. It’s easy to get lost in it. It’s up to you whether you’d like to incorporate it.

๐Ÿ‘€ Start by taking a look at what’s available:

๐Ÿ’ป Customize the look of your site

  • add classes and ids to the html and css
  • use variables in the css to more easily change color themes

๐Ÿ’ญ Some ideas:


[4] Deliverables #

โšกโœจ

๐Ÿ’ป Push your work to Github:

  • git status
  • git add -A
  • git status
  • git commit -m "your message goes here"
    • be sure to customize this message, do not copy and paste this line
  • git push