summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJonathan Slenders <jonathan@slenders.be>2013-08-14 16:14:32 +0200
committerTim Graham <timograham@gmail.com>2013-08-14 12:40:19 -0400
commitff410565bf1cf1a2905c1ef83db408d455211446 (patch)
tree5f2ecee536c3a2ae1a9bea58d20ec537d669ee71 /docs
parent71c491972eecae8783cf46e69fac7e5f9f83fc59 (diff)
Fixed #20709 -- Allowed {% widthratio %} to accept an "as" parameter.
Thanks clay.evil@ for the suggestion.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/templates/builtins.txt8
-rw-r--r--docs/releases/1.7.txt3
2 files changed, 11 insertions, 0 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index afb6e4b123..1fadf77d50 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -1108,6 +1108,14 @@ 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).
+.. versionchanged:: 1.7
+
+In some cases you might want to capture the result of ``widthratio`` in a
+variable. It can be useful, for instance, in a :ttag:`blocktrans` like this::
+
+ {% widthratio this_value max_value max_width as width %}
+ {% blocktrans %}The width is: {{ width }}{% endblocktrans %}
+
.. templatetag:: with
with
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index f4bbd058d6..6f6efcb3ca 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -156,6 +156,9 @@ Minor features
:meth:`~django.contrib.auth.models.User.email_user()` are passed to the
underlying :meth:`~django.core.mail.send_mail()` call.
+* The :ttag:`widthratio` template tag now accepts an "as" parameter to capture
+ the result in a variable.
+
Backwards incompatible changes in 1.7
=====================================