From c73a3caa317566b239a673d24c7d68acaa4586e8 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Mon, 26 Oct 2015 21:46:18 +0000 Subject: [PATCH] Use rendition.alt in `{% image img as rendition %}` example. This restores the documentation to the pre-#1517 state, and is evidently more natural to write since the original documentation did so by mistake :-) --- docs/topics/images/using_in_templates.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/topics/images/using_in_templates.rst b/docs/topics/images/using_in_templates.rst index ae3c97c7b..f9e711ea3 100644 --- a/docs/topics/images/using_in_templates.rst +++ b/docs/topics/images/using_in_templates.rst @@ -146,16 +146,16 @@ Wagtail can assign the image data to another variable using Django's ``as`` synt {% image page.photo width-400 as tmp_photo %} {{ page.photo.title }} + height="{{ tmp_photo.height }}" alt="{{ tmp_photo.alt }}" class="my-custom-class" /> This syntax exposes the underlying image "Rendition" (``tmp_photo``) to the developer. A "Rendition" contains just the information specific to the way you've requested to format the image i.e dimensions and source URL. If your site defines a custom image model using ``AbstractImage``, then any additional fields you add to an image e.g a copyright holder, are **not** part of the image *rendition*, they're part of the image *model*. -Therefore in the above example, if you'd added the field ``foo`` to your AbstractImage you'd access it using ``{{ page.photo.foo }}`` not ``{{ tmp_photo.foo }}``. +Therefore in the above example, if you'd added the field ``author`` to your AbstractImage you'd access it using ``{{ page.photo.author }}`` not ``{{ tmp_photo.author }}``. -(Due to the links in the database between renditions and their parent image, you could also access it as ``{{ tmp_photo.image.foo }}`` but this is clearly confusing.) +(Due to the links in the database between renditions and their parent image, you could also access it as ``{{ tmp_photo.image.author }}`` but this is clearly confusing.) .. Note::