Opened 7 years ago

Closed 5 years ago

#17356 closed New feature (fixed)

Allow {% include %} to render compiled templates on the context

Reported by: Chris Beaven Owned by: nobody
Component: Template system Version: master
Severity: Normal Keywords:
Cc: FunkyBob Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


A fanciful example:

template = template.Template('Buy me {% include subtemplate %}.')
context = template.Context({
    'subtemplate': template.Template('some {{ produce }}'),
    'produce': 'apples',
print template.render(context)

Attachments (1)

17356.diff (2.5 KB) - added by Chris Beaven 7 years ago.
Patch with test & docs

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by Chris Beaven

Attachment: 17356.diff added

Patch with test & docs

comment:1 Changed 7 years ago by Chris Beaven

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 7 years ago by Adrian Holovaty

When would somebody actually need to use this feature?

comment:3 Changed 7 years ago by Chris Beaven

Well, personally I had the case a while back when I wanted to use a dynamically built sub-template like this.

More recently, someone asked about this in IRC. I had a quick look and saw it was easy to implement.

comment:4 Changed 6 years ago by Jacob

Triage Stage: Design decision neededAccepted

comment:5 Changed 5 years ago by FunkyBob

Cc: FunkyBob added

I've just made a PR with a solution to this:

comment:6 Changed 5 years ago by loic84

Triage Stage: AcceptedReady for checkin
Version: 1.3master

comment:7 Changed 5 years ago by Anssi Kääriäinen <akaariai@…>

Resolution: fixed
Status: newclosed

In 5cdacbda034af928f5033c9afc7b50ee0b13f75c:

Fixed #17356 -- Allowed {% include %} to render compiled templates

Reviewed by Loic Bistuer and Tim Graham.

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