diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index aca2f41..b5c8cf2 100644
a
|
b
|
def widthratio(parser, token):
|
1319 | 1319 | |
1320 | 1320 | For example:: |
1321 | 1321 | |
1322 | | <img src='bar.gif' height='10' width='{% widthratio this_value max_value 100 %}' /> |
| 1322 | <img src='bar.gif' height='10' width='{% widthratio this_value max_value max_width %}' /> |
1323 | 1323 | |
1324 | | Above, if ``this_value`` is 175 and ``max_value`` is 200, the image in |
1325 | | the above example will be 88 pixels wide (because 175/200 = .875; |
1326 | | .875 * 100 = 87.5 which is rounded up to 88). |
| 1324 | If ``this_value`` is 175, ``max_value`` is 200, and ``max_width`` is 100, |
| 1325 | the image in the above example will be 88 pixels wide |
| 1326 | (because 175/200 = .875; .875 * 100 = 87.5 which is rounded up to 88). |
1327 | 1327 | """ |
1328 | 1328 | bits = token.contents.split() |
1329 | 1329 | if len(bits) != 4: |
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index 57ef0cf..dd288ab 100644
a
|
b
|
value to a maximum value, and then applies that ratio to a constant.
|
1079 | 1079 | For example:: |
1080 | 1080 | |
1081 | 1081 | <img src="bar.png" alt="Bar" |
1082 | | height="10" width="{% widthratio this_value max_value 100 %}" /> |
| 1082 | height="10" width="{% widthratio this_value max_value max_width %}" /> |
1083 | 1083 | |
1084 | | Above, if ``this_value`` is 175 and ``max_value`` is 200, the image in the |
1085 | | above example will be 88 pixels wide (because 175/200 = .875; .875 * 100 = 87.5 |
1086 | | which is rounded up to 88). |
| 1084 | If ``this_value`` is 175, ``max_value`` is 200, and ``max_width`` is 100, the |
| 1085 | image in the above example will be 88 pixels wide |
| 1086 | (because 175/200 = .875; .875 * 100 = 87.5 which is rounded up to 88). |
1087 | 1087 | |
1088 | 1088 | .. templatetag:: with |
1089 | 1089 | |