From 83662c2910bb046ccb280d47b99d74fb4a193156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9DNyymix=E2=80=9D?= Date: Wed, 9 Apr 2025 09:22:46 +0300 Subject: [PATCH] Add exif keywords --- gallery/templates/gallery/photo_detail.html | 4 ++++ gallery/templatetags/exif_filters.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/gallery/templates/gallery/photo_detail.html b/gallery/templates/gallery/photo_detail.html index 32d9360..47dd3ef 100644 --- a/gallery/templates/gallery/photo_detail.html +++ b/gallery/templates/gallery/photo_detail.html @@ -107,6 +107,10 @@
Focal Length in 35mm
{{ photo.exif.FocalLengthIn35mmFilm|exif_focallength }}
+
+
Keywords
+
{{ photo.exif.Keywords|exif_keywords }}
+
diff --git a/gallery/templatetags/exif_filters.py b/gallery/templatetags/exif_filters.py index 5967f75..bae9cf6 100644 --- a/gallery/templatetags/exif_filters.py +++ b/gallery/templatetags/exif_filters.py @@ -43,5 +43,15 @@ def exif_isospeedratings(value): """Convert ISO Speed Ratings""" try: return f"{int(value)}" + except: + return "" + + +@register.filter(name="exif_keywords") +def exif_keywords(value): + """Convert Keywords""" + try: + words = list(dict.fromkeys(value)) + return ", ".join(words) except: return "" \ No newline at end of file