#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 , 9 years ago
comment:2 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
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 , 9 years ago
comment:6 by , 9 years ago
Triage Stage: | Accepted → Someday/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:9 by , 5 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 , 5 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Summary: | Remove ifequal from the template language → Remove 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 , 5 years ago
Triage Stage: | Someday/Maybe → Accepted |
---|
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?