mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #29288 -- Made {% widthratio %} assign to as var if an exception occurs.
This commit is contained in:
committed by
Tim Graham
parent
9fd9f8bbb2
commit
6148dda72f
@@ -483,9 +483,9 @@ class WidthRatioNode(Node):
|
||||
ratio = (value / max_value) * max_width
|
||||
result = str(round(ratio))
|
||||
except ZeroDivisionError:
|
||||
return '0'
|
||||
result = '0'
|
||||
except (ValueError, TypeError, OverflowError):
|
||||
return ''
|
||||
result = ''
|
||||
|
||||
if self.asvar:
|
||||
context[self.asvar] = result
|
||||
|
||||
Reference in New Issue
Block a user