Opened 17 years ago
Closed 17 years ago
#6872 closed (wontfix)
Filter won't run with noexistent variable.
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 0.96 |
Severity: | Keywords: | filter variable | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have following simple test filter (just simple showcase):
@register.filter def simplefilter(input,noexvar): return "Return"
Template systen won't run the filter (and won't throw any error) when I call it with noexistent variable like this:
{{ some_variable|simplefilter:noexistent_one }}
It's really a problem because I can't provide some default variable like this (which would be really cool feature by the way):
{{ some_variable|simplefilter:(noexistent_one|default:some_default) }}
When noexistent_one actually exists the filter will be runt without problems..
Silent failure of template variables is a design choice. We are currently discussing modifying that behavior on django-developers.