Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.5.X] Fixed #19470 - Clarified widthratio example.

Thanks orblivion for the suggestion.

Backport of 6534a95 from master
  • Loading branch information...
commit 034c3551188189cc0faa9a9ccc88a191c855aa45 1 parent e11bd5c
Tim Graham authored December 18, 2012
8  django/template/defaulttags.py
@@ -1319,11 +1319,11 @@ 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:
8  docs/ref/templates/builtins.txt
@@ -1068,11 +1068,11 @@ value to a maximum value, and then applies that ratio to a constant.
1068 1068
 For example::
1069 1069
 
1070 1070
     <img src="bar.png" alt="Bar"
1071  
-         height="10" width="{% widthratio this_value max_value 100 %}" />
  1071
+         height="10" width="{% widthratio this_value max_value max_width %}" />
1072 1072
 
1073  
-Above, if ``this_value`` is 175 and ``max_value`` is 200, the image in the
1074  
-above example will be 88 pixels wide (because 175/200 = .875; .875 * 100 = 87.5
1075  
-which is rounded up to 88).
  1073
+If ``this_value`` is 175, ``max_value`` is 200, and ``max_width`` is 100, the
  1074
+image in the above example will be 88 pixels wide
  1075
+(because 175/200 = .875; .875 * 100 = 87.5 which is rounded up to 88).
1076 1076
 
1077 1077
 .. templatetag:: with
1078 1078
 

0 notes on commit 034c355

Please sign in to comment.
Something went wrong with that request. Please try again.