Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#14908 closed (fixed)

Add takes_context parameter to simple_tag decorator

Reported by: Julien Phalip Owned by: Julien Phalip
Component: Template system Version: 1.2
Severity: Keywords:
Cc: Craig de Stigter Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

There is no "simple" way for accessing the context in a template tag. The only options are to use an inclusion_tag (which also requires the use of a template) or to create a Node/parser (which is tedious).

To address this, the consensus in (1) is to make simple_tag consistent with inclusion_tag by introducing a takes_context decorator parameter.

(1) http://groups.google.com/group/django-developers/browse_thread/thread/fbf7d9fd8f256b17/

Attachments (1)

14908_simple_tag_takes_context_r14922.diff (7.3 KB) - added by Julien Phalip 6 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by Craig de Stigter

Cc: Craig de Stigter added

comment:2 Changed 6 years ago by Julien Phalip

Whoops, I forgot to grab the ticket myself, as I was going to work on a patch tomorrow. cdestigter, happy for you to do it, though remember that a patch has to be finalised by this weekend for this to stand a chance to be included in 1.3.
You might find good pointers in the patch I've done for #1105.

comment:3 Changed 6 years ago by Craig de Stigter

Owner: changed from nobody to Julien Phalip

julien, it's all yours. I just cc'd myself since I'm keen to see this happen; not intending to write it myself ;)

Changed 6 years ago by Julien Phalip

comment:4 Changed 6 years ago by Julien Phalip

milestone: 1.3

Hopefully this gets considered for 1.3 :)

comment:5 Changed 6 years ago by Craig de Stigter

Has patch: set

comment:6 Changed 6 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [14987]) Fixed #14908 -- Added a 'takes_context' argument to simple_tag. Thanks to Julien Phalip for driving the issue and providing the final patch.

comment:7 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

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