Opened 16 years ago

Closed 16 years ago

#7462 closed (duplicate)

Add context support to simple_tag

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

Description

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

Download all attachments as: .zip

Change History (7)

comment:1 by Julien Phalip, 16 years ago

Just adding that:

You can still do:

@register.simple_tag
def my_tag(bla):

You can now also do:

@register.simple_tag(takes_context=True)
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):

@register.simple_tag()
def my_tag(bla):

comment:2 by simon, 16 years ago

Needs documentation: set
Needs tests: set

by Julien Phalip, 16 years ago

comment:3 by Julien Phalip, 16 years ago

Updated patch with regression tests and doc.

comment:4 by Johannes Dollinger, 16 years ago

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

comment:5 by Julien Phalip, 16 years ago

Owner: changed from nobody to Julien Phalip

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

comment:6 by Julien Phalip, 16 years ago

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