Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#2908 closed defect (wontfix)

include template tag not allowing block tags

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

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 Changed 9 years ago by SmileyChris

  • Resolution set to wontfix
  • Status changed from new to closed

#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 Changed 9 years ago by SmileyChris

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 Changed 9 years ago by anonymous

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 Changed 9 years ago by SmileyChris

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