Issue
I'm developing a website using the Django framework. I want to use one file (base.html) to establish a header and footer on every page. I have done this, but Django is now ignoring the code that's already in the other html files.
This is the code for frontpage.html. I'm intending for the code below to use the code from both base.html and frontpage.html, but it's only using the code from base.html:
{% extends "base.html" %}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Example</p>
<p>Example</p>
<p>Example</p>
<p>Example</p>
</body>
</html>
Solution
I figured out why I didn't get the intended result. "extends" should have been "include". "Extends" appears to overwrite the code that's already in the file, while "include" appears to include the code from the other file in this one.
Answered By - Karl Green
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.