Opened 7 years ago
Closed 7 years ago
#29060 closed Bug (fixed)
Make {% firstof %} assign '' to the asvar if all inputs are false
Reported by: | Roger Gammans | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 1.8 |
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 (last modified by )
I have verified this in version 1.8 and 2.0.
firstof with an 'as' clause doesn't set; or reset the target context variable if all parameters are false. I would expect the context variable to be set to None or the empty string to match the replacement mode behaviour of the tag.
As per summary.; Will add reference to a PR 9618 ( https://github.com/django/django/pull/9618 ) has a fix and example unittest
Change History (3)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
Summary: | FirstOf with an 'as' clause has confusing behaviour in all false case → Make {% firstof %} assign '' to the asvar if all inputs are false |
---|---|
Triage Stage: | Unreviewed → Ready for checkin |
comment:3 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In d0b44c44: