Answer the question
In order to leave comments, you need to log in
Why isn't extends django output?
Can't extend base.html template with header.html template Base.html
content
<div id="main-container">
<!-- HEADER -->
{% block header %}{% endblock %}
<!-- END HEADER -->
</div>
{% extends "blog/base.html" %}
{% block header %}
<header id="header">
***
</header>
{% endblock %}
from django.shortcuts import render
from django.utils import timezone
from .models import Post
from django.shortcuts import render, get_object_or_404
def post_list(request):
posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
return render(request, 'blog/index.html', {'posts': posts})
def post_detail(request, pk):
post = get_object_or_404 (Post, pk=pk)
return render(request, 'blog/base.html', {'post': post})
def header(request):
return render (request, 'blog/header.html')
<div id="main-container">
<!-- HEADER -->
<!-- END HEADER -->
{% include "blog/header.html" %}
- it works, but not through extends. I am using Django 1.10.1
Answer the question
In order to leave comments, you need to log in
these are different things
stackoverflow.com/questions/2863695/include-vs-ext...
stackoverflow.com/questions/2323020/django-extends
... ...
djbook.ru/rel1.9/ref/templates/builtins.html#std:t...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question