0
0
Djangoframework~10 mins

Template includes for reusability in Django - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to include a reusable header template in your main template.

Django
{% include '[1]' %}
Drag options to blanks, or click blank then click option'
Asidebar.html
Bfooter.html
Cheader.html
Dbase.html
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong template filename.
Forgetting to put the filename in quotes.
2fill in blank
medium

Complete the code to include a navigation bar template inside a base template.

Django
<nav>{% include '[1]' %}</nav>
Drag options to blanks, or click blank then click option'
Anavbar.html
Bcontent.html
Csidebar.html
Dfooter.html
Attempts:
3 left
💡 Hint
Common Mistakes
Including unrelated templates like footer or content inside the nav tag.
Misspelling the template filename.
3fill in blank
hard

Fix the error in the code to correctly include a reusable sidebar template.

Django
{% include [1] %}
Drag options to blanks, or click blank then click option'
Asidebar.html
B'sidebar.html'
C"sidebar.html"
Dsidebar
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around the template name.
Using variable names without quotes.
4fill in blank
hard

Fill both blanks to include a reusable footer template and pass a variable named 'year' to it.

Django
{% include '[1]' with [2]=current_year %}
Drag options to blanks, or click blank then click option'
Afooter.html
Bheader.html
Cyear
Ddate
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong template filename.
Passing a variable name that the included template does not use.
5fill in blank
hard

Fill all three blanks to include a reusable card template, pass a title and content variables to it.

Django
{% include '[1]' with [2]=card_title [3]=card_content %}
Drag options to blanks, or click blank then click option'
Acard.html
Btitle
Ccontent
Dheader.html
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect template filenames.
Passing variables with wrong names or missing variables.