Opened 9 years ago

Closed 4 years ago

Last modified 3 years ago

#25236 closed Cleanup/optimization (fixed)

Remove ifequal from the template language.

Reported by: Daniel Greenfeld Owned by: Jon Dufresne
Component: Template system Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

No modern project uses ifequal. No one recommends it. I argue it is taking up valuable bytes in the project. Let's remove it.

Change History (13)

comment:1 by Tim Graham, 9 years ago

Seems like a good idea, although I am afraid we may get more pushback regarding "needless deprecations" from old, large Django projects that use it. A middle ground could be to remove it from the documentation. Would you like to write to the DevelopersMailingList to see what others think?

comment:2 by Marc Tamlyn, 9 years ago

Triage Stage: UnreviewedAccepted

The smart if tag which made ifequal redundant was introduced in Django 1.2. Really, ifequal should have been deprecated then. I agree this is a good candidate for deprecation, and I'd rather take a bit of flak for "needless" deprecations than keep tested (?) but undocumented code around forever.

comment:3 by Daniel Greenfeld, 9 years ago

Submitted to the dev mailing list.

Version 0, edited 9 years ago by Daniel Greenfeld (next)

comment:4 by Tim Graham <timograham@…>, 9 years ago

In a3830f6:

Refs #25236 -- Removed ifequal/ifnotequal usage.

comment:5 by Tim Graham <timograham@…>, 9 years ago

In 787cc7a:

Refs #25236 -- Discouraged use of ifequal/ifnotequal template tags.

comment:6 by Tim Graham, 9 years ago

Triage Stage: AcceptedSomeday/Maybe

Moving to "Someday/Maybe" as we have multiple complaints on the mailing list that updating projects for this removal will be too onerous to justify the cleanup.

comment:7 by Tim Graham <timograham@…>, 9 years ago

In 21128793:

[1.8.x] Refs #25236 -- Discouraged use of ifequal/ifnotequal template tags.

Backport of 787cc7aa843d5c0834f56b5f8ae03b86ce553c51 from master

comment:8 by Mariusz Felisiak, 4 years ago

PR. I think we should refresh discussion on the mailing list.

comment:9 by Jon Dufresne, 4 years ago

The following quick and dirty script will update a codebase to the newer {% if %} syntax. This will update files in place, so please be sure to backup your code first, preferably with SCM. You should examine the results of the diff for correctness before accepting.

find $(find -name templates) -type f -exec perl -pi -e 's/{% *ifequal +(.+?) +(.+?) *%}/{% if $1 == $2 %}/;' -e 's/{% *endifequal *%}/{% endif %}/;' -e 's/{% *ifnotequal +(.+?) +(.+?) *%}/{% if $1 != $2 %}/;' -e 's/{% *endifnotequal *%}/{% endif %}/;' {} \;

comment:10 by Mariusz Felisiak, 4 years ago

Has patch: set
Owner: changed from nobody to Jon Dufresne
Status: newassigned
Summary: Remove ifequal from the template languageRemove ifequal from the template language.

We didn't get any new complains on the mailing list, so it's time to remove them.

comment:11 by Mariusz Felisiak, 4 years ago

Triage Stage: Someday/MaybeAccepted

comment:12 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 72a170b:

Fixed #25236 -- Deprecated {% ifequal %} and {% ifnotequal %} template tags.

The {% if %} tag provides all features of these tags.

Since Django 1.2 (May 17, 2010), the docs have hinted that
{% ifequal %} and {% ifnotequal %} will be deprecated in a future
Django version. Time to make it official.

comment:13 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In e7208f1:

Refs #25236 -- Removed {% ifequal %} and {% ifnotequal %} template tags per deprecation timeline.

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