Opened 8 years ago

Closed 8 years ago

#27608 closed New feature (duplicate)

Combine simple_tag and assignment_tag

Reported by: Jimmy Merrild Krag Owned by: nobody
Component: Template system Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It would be awesome if simple_tag could used as an assignment_tag as well, such that there were two forms of uses of the same tag:

{% mytag argument1 argument2 %}
and
{% mytag argument1 argument2 as variable %}

Where the first function as simple_tag does now and the second as assignment_tag, but both are defined by the same function.

Change History (2)

comment:1 by Jimmy Merrild Krag, 8 years ago

Type: UncategorizedNew feature

comment:2 by Tim Graham, 8 years ago

Resolution: duplicate
Status: newclosed

This is done as of Django 1.9 (#18651), and assignment_tag is deprecated per the 1.9 release notes:

Django 1.4 added the assignment_tag helper to ease the creation of template tags that store results in a template variable. The simple_tag() helper has gained this same ability, making the assignment_tag obsolete. Tags that use assignment_tag should be updated to use simple_tag.

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