Opened 10 years ago

Closed 10 years ago

#7462 closed (duplicate)

Add context support to simple_tag

Reported by: Julien Phalip Owned by: Julien Phalip
Component: Template system Version: master
Severity: Keywords:
Cc: django@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:


This patch is backward compatible and add context support to simple_tag, in the same way as inclusion_tag already does.

Attachments (1)

simple_tag_takes_context.diff (7.2 KB) - added by Julien Phalip 10 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 10 years ago by Julien Phalip

Just adding that:

You can still do:

def my_tag(bla):

You can now also do:

def my_tag(context, bla):

Note that the following (with brackets but without arguments) will be accepted and work the same as the current code (without brackets):

def my_tag(bla):

comment:2 Changed 10 years ago by simon

Needs documentation: set
Needs tests: set

Changed 10 years ago by Julien Phalip

comment:3 Changed 10 years ago by Julien Phalip

Updated patch with regression tests and doc.

comment:4 Changed 10 years ago by Johannes Dollinger

duplicate of #1105, which also adds takes_block=True but only has an outdated patch.

comment:5 Changed 10 years ago by Julien Phalip

Owner: changed from nobody to Julien Phalip

Ok, I'm now working on adding takes_block support as well.

comment:6 Changed 10 years ago by Julien Phalip

Resolution: duplicate
Status: newclosed

I'll close this one in favour of ticket #1105. I've posted the follow up of my work there so check it out for more updates.

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