django - Why is template inheritance Failing? -
edit: please not mislead question, fault changes not working out. happen have projects named same(not smart idea
) confused everything, making changes in different project working in. sorry stackoverflow folks mislead.
i have base template public_base.html
<!doctype html> <!-- [if ie ]> <html class="no-js"> <![endif] --> <head> <!-- favicon web browser , smartphones --> <link rel="icon" href="{{ static_url }}images/img.png" type="image/x-png"> <link rel="apple-touch-icon" href="{{ static_url }}img/apple-touch-icon.png"> <!-- google fonts --> <link href='http://fonts.googleapis.com/css?family=homenaje|molengo' rel='stylesheet' type='text/css'> <!-- css section --> <link type="text/css" rel="stylesheet" href="{{ static_url }}maincss/bootstrap.min.css"> <link type="text/css" rel="stylesheet" href="{{ static_url }}maincss/impress.css"> <link type="text/css" rel="stylesheet" href="{{ static_url }}maincss/style.css"> <link type="text/css" rel="stylesheet" href="{{ static_url }}maincss/impression.css"> <title>{% block title %}f4l | have easy{% endblock %}</title> </head> <body lang="en"> <div id="container"> {% load smartmin %} <div id="header"> <!-- header --> <div id="logo"> <a href="{% url homepage %}"> <img src="{{ static_url }}img/logo.jpg" class="" alt="" /> </a> </div> <div id="menu"> <ul> {% if perms.restaurant_detail.restaurant_detail.create %} <li><a href="#">join f4l</a></li> {% endif %} <li><a href="#">faq</a></li> <li><a href="#">contact</a></li> <li><a href="#">about us</a></li> {% if request.user.is_authenticated %} <li><a href="{% url users.user_logout %}">logout</a></li> {% else %} <li><a href="{% url users.user_login %}">login</a></li> {% endif %} </ul> </div> </div> <!-- end header --> <div style="clear: both;"></div> <div id="main"> <!-- main --> {% block main-contents %} <p>jrneflkwnel</p> {% endblock %} </div> </div>
that inherit here, home.html
{% extends "public_base.html" %} {% block main-contents %} <p>this not working.</p> {% endblock main-contents %}
but not working @ all,basically content in home.html
not loading. causing this?
you need inherit block in home.html
:
{% extends "public_base.html" %} {% block main-contents %} <p>this not working.</p> {% endblock %}
have read through the docs on template inheritence, specifically:
[when inherit parent template] template engine notice 3 block tags in base.html , replace blocks contents of child template.
so when inherit parent template, need include block in child template overrides block in parent template, in case main-contents
block.
Comments
Post a Comment