diff options
| author | Tim Graham <timograham@gmail.com> | 2012-12-18 06:52:30 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2012-12-18 08:20:51 -0500 |
| commit | 034c3551188189cc0faa9a9ccc88a191c855aa45 (patch) | |
| tree | 31a966498329366cc94e5b41decc314aced39ff2 | |
| parent | e11bd5c5ac0c7d85723451f8da7b6ad30fefc680 (diff) | |
[1.5.X] Fixed #19470 - Clarified widthratio example.
Thanks orblivion for the suggestion.
Backport of 6534a95ac3 from master
| -rw-r--r-- | django/template/defaulttags.py | 8 | ||||
| -rw-r--r-- | docs/ref/templates/builtins.txt | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index aca2f41f2d..b5c8cf2d36 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -1319,11 +1319,11 @@ def widthratio(parser, token): For example:: - <img src='bar.gif' height='10' width='{% widthratio this_value max_value 100 %}' /> + <img src='bar.gif' height='10' width='{% widthratio this_value max_value max_width %}' /> - Above, if ``this_value`` is 175 and ``max_value`` is 200, the image in - the above example will be 88 pixels wide (because 175/200 = .875; - .875 * 100 = 87.5 which is rounded up to 88). + If ``this_value`` is 175, ``max_value`` is 200, and ``max_width`` is 100, + the image in the above example will be 88 pixels wide + (because 175/200 = .875; .875 * 100 = 87.5 which is rounded up to 88). """ bits = token.contents.split() if len(bits) != 4: diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index f8aedf79a0..ca8c648b1e 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -1068,11 +1068,11 @@ value to a maximum value, and then applies that ratio to a constant. For example:: <img src="bar.png" alt="Bar" - height="10" width="{% widthratio this_value max_value 100 %}" /> + height="10" width="{% widthratio this_value max_value max_width %}" /> -Above, if ``this_value`` is 175 and ``max_value`` is 200, the image in the -above example will be 88 pixels wide (because 175/200 = .875; .875 * 100 = 87.5 -which is rounded up to 88). +If ``this_value`` is 175, ``max_value`` is 200, and ``max_width`` is 100, the +image in the above example will be 88 pixels wide +(because 175/200 = .875; .875 * 100 = 87.5 which is rounded up to 88). .. templatetag:: with |
