diff --git a/.gitignore b/.gitignore
index b106e528..4be192ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ notes.txt
build
*venv
.idea/*
+.cache/
alyx/alyx_full.sql.gz
.vscode/
alyx/data/management/commands/*ibl*
diff --git a/alyx/misc/admin.py b/alyx/misc/admin.py
index 447e1029..b7c22fb3 100644
--- a/alyx/misc/admin.py
+++ b/alyx/misc/admin.py
@@ -8,6 +8,7 @@
from django.contrib.contenttypes.admin import GenericTabularInline
from django.contrib.postgres.fields import JSONField
from django.utils.html import format_html, format_html_join
+from django.utils.safestring import mark_safe
from misc.models import Note, Lab, LabMembership, LabLocation, CageType, \
Enrichment, Food, Housing, HousingSubject
@@ -80,16 +81,16 @@ class LabLocationAdmin(BaseAdmin):
class AdminImageWidget(AdminFileWidget):
+
def render(self, name, value, attrs=None, renderer=None):
output = []
if value and getattr(value, "url", None):
image_url = value.url
file_name = str(value)
- output.append((''
- '
') %
- (image_url, image_url, file_name))
+ output.append(f''
+ f'
')
output.append(super(AdminFileWidget, self).render(name, value, attrs, renderer))
- return ''.join(output)
+ return mark_safe(''.join(output))
class ImageWidgetAdmin(BaseAdmin):