Opened 7 years ago

Closed 6 years ago

#12847 closed New feature (fixed)

Allow simple_tags to specify a function name

Reported by: David Cramer Owned by: Vladimir Moskva
Component: Template system Version: 1.1
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It would be useful if simple_tag allowed you to specify the function name.

e.g.

register.simple_tag(lambda x: x-1, 'minusone')

Attachments (2)

renamed_simple_tags.patch (3.0 KB) - added by Vladimir Moskva 6 years ago.
renamed_simple_tags.2.patch (4.2 KB) - added by Vladimir Moskva 6 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 7 years ago by Chris Beaven

Triage Stage: UnreviewedAccepted

It'd also be useful for if you want the simple tag to have a different name than the actual function name.

comment:2 Changed 6 years ago by Luke Plant

Type: New feature

comment:3 Changed 6 years ago by Luke Plant

Severity: Normal

comment:4 Changed 6 years ago by Vladimir Moskva

Easy pickings: unset
Owner: changed from nobody to Vladimir Moskva
Status: newassigned
UI/UX: unset

Changed 6 years ago by Vladimir Moskva

Attachment: renamed_simple_tags.patch added

Changed 6 years ago by Vladimir Moskva

Attachment: renamed_simple_tags.2.patch added

comment:5 Changed 6 years ago by Vladimir Moskva

Has patch: set

There is already one optional keyword argument (takes_context=None), so it was reasonable to make a keyword argument name="new_name".

Tests and docs are included in the second patch.

comment:6 Changed 6 years ago by Jannis Leidel

Triage Stage: AcceptedReady for checkin

comment:7 Changed 6 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

In [16373]:

Fixed #12847 -- Added name parameter to simple_tag, assignment_tag and inclusion_tag helpers. Thanks, vladmos.

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