简体   繁体   中英

django template language not working

#base.html
<html>
<head><title>Hello world</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>

#child.html
{% extends base.html %}
{% block content}
    This is the content that
    comes here
{% endblock %}

but the html output of base.html not displaying content.? Why this template language not working ?

Template inheritance includes the parent template in the child, not the other way around.

Render child.html and you'll see your content surrounded by the base.html (parent) markup.

Also, you need to quote the parent template name:

{% extends "base.html" %}
{% block content %}
    Content!
{% endblock %}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM