Opened 14 years ago

Closed 14 years ago

Last modified 13 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: no UI/UX: no

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 14 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Craig de Stigter, 14 years ago

Cc: Craig de Stigter added

comment:2 by Julien Phalip, 14 years ago

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 by Craig de Stigter, 14 years ago

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 ;)

by Julien Phalip, 14 years ago

comment:4 by Julien Phalip, 14 years ago

milestone: 1.3

Hopefully this gets considered for 1.3 :)

comment:5 by Craig de Stigter, 14 years ago

Has patch: set

comment:6 by Russell Keith-Magee, 14 years ago

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 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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