Ticket #19470: 19470.diff

File 19470.diff, 1.8 KB (added by Tim Graham, 12 years ago)
  • django/template/defaulttags.py

    diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
    index aca2f41..b5c8cf2 100644
    a b def widthratio(parser, token):  
    13191319
    13201320    For example::
    13211321
    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 %}' />
    13231323
    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).
    13271327    """
    13281328    bits = token.contents.split()
    13291329    if len(bits) != 4:
  • docs/ref/templates/builtins.txt

    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.  
    10791079For example::
    10801080
    10811081    <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 %}" />
    10831083
    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).
     1084If ``this_value`` is 175, ``max_value`` is 200, and ``max_width`` is 100, the
     1085image in the above example will be 88 pixels wide
     1086(because 175/200 = .875; .875 * 100 = 87.5 which is rounded up to 88).
    10871087
    10881088.. templatetag:: with
    10891089
Back to Top