@@ -736,35 +736,24 @@ def get_sponsor_landing_page_url(self, obj):
736736 @admin .display (description = "Web Logo" )
737737 def get_sponsor_web_logo (self , obj ):
738738 """Render and return the sponsor's web logo as a thumbnail image."""
739- img = obj .sponsor .web_logo
740- if not img :
741- return "---"
742- if img .name and img .name .lower ().endswith (".svg" ):
743- return format_html (
744- '<img src="{}" style="max-width:150px;max-height:150px"/>' ,
745- img .url ,
746- )
747- html = "{% load thumbnail %}{% thumbnail img '150x150' format='PNG' quality=100 as im %}<img src='{{ im.url}}'/>{% endthumbnail %}"
739+ html = "{% load thumbnail %}{% thumbnail sponsor.web_logo '150x150' format='PNG' quality=100 as im %}<img src='{{ im.url}}'/>{% endthumbnail %}"
748740 template = Template (html )
749- context = Context ({"img" : img })
750- return mark_safe (template .render (context )) # noqa: S308
741+ context = Context ({"sponsor" : obj .sponsor })
742+ html = template .render (context )
743+ return mark_safe (html ) # noqa: S308
751744
752745 @admin .display (description = "Print Logo" )
753746 def get_sponsor_print_logo (self , obj ):
754747 """Render and return the sponsor's print logo as a thumbnail image."""
755748 img = obj .sponsor .print_logo
756- if not img :
757- return "---"
758- if img .name and img .name .lower ().endswith (".svg" ):
759- return format_html (
760- '<img src="{}" style="max-width:150px;max-height:150px"/>' ,
761- img .url ,
749+ html = "---"
750+ if img :
751+ template = Template (
752+ "{% load thumbnail %}{% thumbnail img '150x150' format='PNG' quality=100 as im %}<img src='{{ im.url}}'/>{% endthumbnail %}"
762753 )
763- template = Template (
764- "{% load thumbnail %}{% thumbnail img '150x150' format='PNG' quality=100 as im %}<img src='{{ im.url}}'/>{% endthumbnail %}"
765- )
766- context = Context ({"img" : img })
767- return mark_safe (template .render (context )) # noqa: S308
754+ context = Context ({"img" : img })
755+ html = mark_safe (template .render (context )) # noqa: S308
756+ return html
768757
769758 @admin .display (description = "Primary Phone" )
770759 def get_sponsor_primary_phone (self , obj ):
0 commit comments