3

Having trouble overriding a block tag inside my include.

I have

base.html

<div>
  {% include 'snippet.html' %}
</div>

snippet.html

<h1>{% block h1 %}{% endblock h1 %}</h1>

index.html

{% extends 'base.html' %}
{% block h1 %}Hello World{% endblock h1 %}

I'd expect it to render as:

<div>
  <h1>Hello World</h1>
</div>

But no such luck. Any ideas?

anthony-dandrea
  • 2,583
  • 7
  • 26
  • 46
  • 1
    I wonder if something like [this solution for the opposite problem](http://stackoverflow.com/a/9674433/3004881) would work for yours, too? – Dan Getz May 27 '15 at 01:47
  • Yea, macros is another solution. Seemed like a weird way to use them to me though so I just opted with throwing everything in base. – anthony-dandrea May 29 '15 at 18:18

1 Answers1

1

Ended up just putting everything in base.html

anthony-dandrea
  • 2,583
  • 7
  • 26
  • 46