0
0
Djangoframework~10 mins

Template variables with double braces 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 display the variable username in a Django template.

Django
<p>Hello, {{ [1] }}!</p>
Drag options to blanks, or click blank then click option'
Auser
Bname
Cusername
Duser_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using single braces instead of double braces.
Misspelling the variable name.
2fill in blank
medium

Complete the code to show the email variable inside a paragraph in a Django template.

Django
<p>Your email is: {{ [1] }}</p>
Drag options to blanks, or click blank then click option'
Aemail
Buser_email
Ccontact
Dmail
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect variable names.
Forgetting the double braces.
3fill in blank
hard

Fix the error in the template code to correctly display the title variable.

Django
<h1>{{ [1] }}</h1>
Drag options to blanks, or click blank then click option'
Atitle
Bheader
Cheading
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Using only one closing brace instead of two.
Using wrong variable names.
4fill in blank
hard

Fill both blanks to display the first_name and last_name variables separated by a space.

Django
<p>{{ [1] }} {{ [2] }}</p>
Drag options to blanks, or click blank then click option'
Afirst_name
Blast_name
Cfullname
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single variable like 'fullname' instead of separate first and last names.
Forgetting the double braces.
5fill in blank
hard

Fill all three blanks to display the user object's username, email, and age properties.

Django
<p>Username: {{ [1] }}</p>
<p>Email: {{ [2] }}</p>
<p>Age: {{ [3] }}</p>
Drag options to blanks, or click blank then click option'
Auser.username
Buser.email
Cuser.age
Duser.name
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect property names like 'user.name'.
Forgetting the double braces or dot notation.