mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
Thumbnails: fix default size definition in template utility
This commit is contained in:
parent
7a390af07e
commit
bf6ee9f53c
1 changed files with 2 additions and 0 deletions
|
@ -56,6 +56,8 @@ def truncatepath(value, arg):
|
||||||
@register.simple_tag(takes_context=False)
|
@register.simple_tag(takes_context=False)
|
||||||
def get_book_cover_thumbnail(book, size="medium", ext="jpg"):
|
def get_book_cover_thumbnail(book, size="medium", ext="jpg"):
|
||||||
"""Returns a book thumbnail at the specified size and extension, with fallback if needed"""
|
"""Returns a book thumbnail at the specified size and extension, with fallback if needed"""
|
||||||
|
if size == "":
|
||||||
|
size = "medium"
|
||||||
try:
|
try:
|
||||||
cover_thumbnail = getattr(book, "cover_bw_book_%s_%s" % (size, ext))
|
cover_thumbnail = getattr(book, "cover_bw_book_%s_%s" % (size, ext))
|
||||||
return cover_thumbnail.url
|
return cover_thumbnail.url
|
||||||
|
|
Loading…
Reference in a new issue