Opened 6 years ago

Closed 4 years ago

#11805 closed Uncategorized (invalid)

Blocks tags inside inclusion template tags are ignored

Reported by: anonymous Owned by: nobody
Component: Template system Version: 1.1
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

Currently, inclusion_tag templates cannot overwrite blocks in the parent template. The {% block %} tags are simply ignored and the text inside is printed as is.
Is this a design decision or a technical limitation?

This could be very useful for say specifying a CSS stylesheet related to the html generated by the inclusion tag by appending links to the extracss block in base.html.

Change History (3)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Sounds like templates working as intended. A specific example would go a long way to prove your point.

comment:2 Changed 4 years ago by kevindpostal@…

  • Easy pickings unset
  • Resolution invalid deleted
  • Severity set to Normal
  • Status changed from closed to reopened
  • Type set to Uncategorized
  • UI/UX unset

I have a need for this...

I built an app that sets the meta tags on a page. Id like to be able to dynamically overwrite the {% block title %} I set in an inclusion tag

comment:3 Changed 4 years ago by russellm

  • Resolution set to invalid
  • Status changed from reopened to closed

Again - This doesn't sound like an error to me -- it sounds like blocks working as designed. The fact that you'd like it to work a different way doesn't change the fundamental design of the template language.

If you'd like advice on how to achieve something, I suggest asking on django-users.

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