1๐
โ
If you extends a base.html template, no content not surrounded by {% block %} will be rendered at all.
You could create additional {% block precontnet %}{% endblock %}
in base.html
, and wraps Pink/Yellow/Red in user_links.html
Or you can put Pink/Yellow/Red in {% block content %}
if user_links.html
and use {{ block.super }} in user_detail.html
links.html
{% extends "base.html" %}
{% block content %}
Yellow
Pink
Green
{% endblock %}
user_detail.html
{% extends "user_links.html" %}
{% block content %}
{{ block.super }}
<h2>{{ object.username }}'s Profile</h2>
{% if object.userprofile.bio %}
{{ object.userprofile.bio }}
{% endif %}
{% endblock %}
๐คkmmbvnr
0๐
Place div
after </p>
in base.html
<h1>Cool App</h1>
<div class="navbar">
<p>
<a href="{% url 'home' %}">HOME</a> |
{% if user.is_authenticated %}
<a href="{% url 'logout' %}">LOGOUT</a>
{% else %}
<a href="{% url 'login' %}">LOGIN</a>
{% endif %}</p>
</div>
Try this in user_links.html
{% extends "base.html" %}
{% block content %}
Yellow
Pink
Green
{% endblock %}
๐คf43d65
- [Answer]-Django admin removes selected choice in ModelChoiceField on edit?
- [Answer]-Django how to not use cached queryset while iterating?
- [Answer]-Need to access a manytomanyfield in django templates
- [Answer]-CSS didn't work after migration of django website into another instance
Source:stackexchange.com