mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
Fixed #18400 -- Modified length template filter to return 0 for unknown variables.
Thanks Florian for the bug report, luyikei for the initial code patch, and Bouke for the code review feedback.
This commit is contained in:
@@ -578,7 +578,7 @@ def length(value):
|
||||
try:
|
||||
return len(value)
|
||||
except (ValueError, TypeError):
|
||||
return ''
|
||||
return 0
|
||||
|
||||
|
||||
@register.filter(is_safe=False)
|
||||
|
||||
Reference in New Issue
Block a user