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)
Change History (7)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
by , 16 years ago
Attachment: | simple_tag_takes_context.diff added |
---|
comment:4 by , 16 years ago
duplicate of #1105, which also adds takes_block=True
but only has an outdated patch.
comment:5 by , 16 years ago
Owner: | changed from | to
---|
Ok, I'm now working on adding takes_block
support as well.
comment:6 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
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.
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):