.
This commit is contained in:
+6
-2
@@ -42,6 +42,8 @@ from django.contrib.auth.models import User
|
||||
from django.forms.models import model_to_dict
|
||||
from django.forms.utils import from_current_timezone, to_current_timezone
|
||||
|
||||
from loguru import logger
|
||||
|
||||
|
||||
def findMiddle(input_list):
|
||||
"""Returns the middle element of a list"""
|
||||
@@ -419,7 +421,7 @@ class SeriesBase(models.Model):
|
||||
else:
|
||||
return format_html('", "'.join(images))
|
||||
|
||||
def get_thumbnail(self, recreate=False):
|
||||
def get_thumbnail(self, recreate=False, fail_loudly=False):
|
||||
images = self.images.filter(removed=False)
|
||||
|
||||
if len(images) < 1:
|
||||
@@ -431,7 +433,9 @@ class SeriesBase(models.Model):
|
||||
if recreate:
|
||||
thumbnailer.delete_thumbnails()
|
||||
thumbnail = thumbnailer["exam-list"]
|
||||
except InvalidImageFormatError:
|
||||
except InvalidImageFormatError as e:
|
||||
if fail_loudly:
|
||||
raise e
|
||||
return format_html(
|
||||
'<img title="{}" src="/static/not-found-image.jpg" />', img
|
||||
), len(images)
|
||||
|
||||
Reference in New Issue
Block a user