From 4c3291e97204afb404a0d736271ae30831c45fc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-S=C3=A9bastien=20Caux?= <git@jscaux.org>
Date: Thu, 24 Feb 2022 14:11:31 +0100
Subject: [PATCH] Properly handle default logo img. Fixes SCIPOST-1HX

---
 .../organizations/_organization_detail_contents.html      | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scipost_django/organizations/templates/organizations/_organization_detail_contents.html b/scipost_django/organizations/templates/organizations/_organization_detail_contents.html
index 7c1bf8c91..423b78aa3 100644
--- a/scipost_django/organizations/templates/organizations/_organization_detail_contents.html
+++ b/scipost_django/organizations/templates/organizations/_organization_detail_contents.html
@@ -48,12 +48,14 @@
 	<picture>
 	  {% for source in org.logos.all %}
 	    <source type="{{ source.mimetype }}" srcset="{{ source.image.url }} {{ source.width }}w">
+	    {% if forloop.last %}
+	      <img class="rounded" style="max-height: 8rem; max-width: 16rem;"
+		   src="{{ source.url }}" alt="{{ org.name }} logo">
+	    {% endif %}
 	  {% endfor %}
-	  <img class="rounded" style="max-height: 8rem; max-width: 16rem;"
-	       src="{{ org.logo.url }}" alt="{{ org.name }} logo">
 	</picture>
       </li>
-      {% elif org.logo %}
+    {% elif org.logo %}
       <img class="d-flex me-3 {{ org.css_class }}" src="{{ org.logo.url }}" alt="image"/>
     {% endif %}
   </div>
-- 
GitLab