A Django template can contain normal HTML plus Django syntax:
django
<h1>{{ business.name }}</h1>
{{ business.name }} means "insert this value."
You may also see:
django
{% if user.is_authenticated %}
<p>Welcome!</p>
{% endif %}
12. Template loops
django
{% for product in products %}
<h2>{{ product.name }}</h2>
{% endfor %}
The syntax differs from Python, but the programming idea is familiar.
13. Exercise
Create a page with:
header
navigation
main heading
two paragraphs
image
list
call-to-action
contact form
Then identify each HTML element.
14. Reading AI-generated HTML
If ChatGPT gives you:
html
<section class="hero">
<h1>Build Your Business</h1>
<p>Launch your idea online.</p>
<a href="/contact/" class="button">Get Started</a>
</section>
you should be able to identify:
text
section
↓
heading
↓
paragraph
↓
link styled as a button
15. Using ChatGPT
Ask:
Here is my Django template. Explain its HTML structure and tell me which elements I should change to modify the heading, navigation, and button. Do not rewrite unrelated parts.
Remember
Know how to recognize:
text
h1 h2 h3
p
a
img
ul ol li
div
section
nav
form
label
input
textarea
select
button
class
id
You do not need to memorize HTML. You need to be able to read and modify it.
Finished this lesson?
Completion is saved in this browser without creating an account.