Activity 8.02 – displaying the cover and sample link
In this activity, you will update the book_detail.html
template to show the cover for Book
(if one is set). You will also add a link to download the sample again, only if one is set. You will use the FileField
and ImageField
url
attributes to generate the URLs to the media files.
These steps will help you complete this activity:
- Inside the Book Details display in the
book_detail.html
view, add an<img>
element if the book has acover
image. Then, display the cover of the book inside it. Use<br>
after the<img>
tag, so the image is on its own line. - After the Publication Date display, add a link to the sample file. It should only be displayed if a
sample
file has been uploaded. Make sure you add another<br>
tag, so it displays correctly. - In the section that has a link to add a review, add another link that goes to the media page for the book. Follow the same styling as the Add Review...