Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2908 closed defect (wontfix)

include template tag not allowing block tags

Reported by: anonymous Owned by: Adrian Holovaty
Component: Template system Version: dev
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

My assumption is the include "template.html" template tag would allow you to specify block's within the included file.

For example, in template.html I have:

<h2>Some content in my template</h2>
{% block foo %}
<h3>A subtitle in my template</h3>
{% endblock %}

Now in index.html I have:
{% extends "base.html" %}
{% block content %}
<h1>Hello World</h1>
{% include "template.html" %}
{% endblock %}

I would think it would be in good practice to allow me to then do a {% block foo %} within the index.html that would override what was in template.html

Change History (4)

comment:1 by Chris Beaven, 18 years ago

Resolution: wontfix
Status: newclosed

#2778 would probably do what you want, I haven't had time yet to separate it out and wikify it so it can be used without being core.

Apart from that, this isn't a defect so I'll mark as won't fix.

comment:2 by Chris Beaven, 18 years ago

On second thoughts, that patch is actually a bit different to what you want to do.

Anyway, this is mixing up the types of include. Try this:

base.html
template.html {% extends "base.html" %}
index.html    {% extends "template.html" %}

comment:3 by anonymous, 18 years ago

The problem with that solution is it requires the template, keyword, template, to extend a specific file. The goal was to have a generic template that I could reuse with multiple things.

comment:4 by Chris Beaven, 18 years ago

I'd encourage you to take this to the Django user's Google Group.

Note: See TracTickets for help on using tickets.
Back to Top