This commit is contained in:
Ross
2025-01-06 11:14:34 +00:00
parent f0c5964a5a
commit d891c7b9ee
11 changed files with 52 additions and 19 deletions
+6 -2
View File
@@ -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)
+3
View File
@@ -33,8 +33,10 @@ from django.utils.decorators import method_decorator
from django.core.cache import cache
import json
import urllib
import urllib.parse
from django.views import View
from django.views.generic.edit import CreateView, UpdateView, DeleteView
@@ -2652,6 +2654,7 @@ class GenericViewBase:
@method_decorator(login_required)
def question_user_answers_by_compare(self, request, pk, answer_compare):
print(answer_compare)
answer_compare = urllib.parse.unquote(answer_compare)
return self.question_user_answers(request, pk, answer_compare)
@method_decorator(login_required)