1👍
In your about.html
template you need to add
{% block content %}
<!-- Add your about content here -->
{% endblock content %}
You also don’t need <html>
, <head>
or <body>
tags in the about.html file as they are in the base.html file already
👤drew
0👍
I think you want you about.html to look like this.
{% extends "base.html" %}
{% load staticfiles %}
{% block title %}About{% endblock %}
{% block content %}Hi,About!{% endblock %}
Note: You have an <h1>
in your header and I think you actually want that in your <body>
- Django: cretae new object with unique order
- Makemigrations not detecting changes after moving models to a modelsdirectory
- Django/Postgres: Choose from DISTINCT ON sets
- Django / Python – Date joined check
0👍
When you extend base.html your base.html defines entire html page. In your about.html you just need to code what you want to insert in base.html blocks. So, your about.html have to like this
{% extends "base.html" %}
{% load staticfiles %}
{% block title %}
About
{% endblock %}
{% block h1 %}
Hi,About!
{% endblock %}
Source:stackexchange.com