Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#14908 closed (fixed)

Add takes_context parameter to simple_tag decorator

Reported by: julien Owned by: julien
Component: Template system Version: 1.2
Severity: Keywords:
Cc: cdestigter 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 5 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 years ago by cdestigter

  • Cc cdestigter added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 5 years ago by julien

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 5 years ago by cdestigter

  • Owner changed from nobody to julien

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 5 years ago by julien

comment:4 Changed 5 years ago by julien

  • milestone set to 1.3

Hopefully this gets considered for 1.3 :)

comment:5 Changed 5 years ago by cdestigter

  • Has patch set

comment:6 Changed 5 years ago by russellm

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

(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 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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