Fix value error for new org image

This commit is contained in:
cuom1999 2024-07-18 09:20:31 +07:00
parent 9dd779f4fa
commit 6421e4f5be
2 changed files with 5 additions and 4 deletions

View file

@ -417,13 +417,14 @@ class ContestMixin(object):
self.request.user self.request.user
) )
context["logo_override_image"] = self.object.logo_override_image context["logo_override_image"] = self.object.logo_override_image
if ( if (
not context["logo_override_image"] not context["logo_override_image"]
and self.object.organizations.count() == 1 and self.object.organizations.count() == 1
): ):
context[ org_image = self.object.organizations.first().organization_image
"logo_override_image" if org_image:
] = self.object.organizations.first().organization_image.url context["logo_override_image"] = org_image.url
return context return context

View file

@ -1,6 +1,6 @@
{% if request.in_contest_mode and request.participation.contest.logo_override_image %} {% if request.in_contest_mode and request.participation.contest.logo_override_image %}
<img src="{{ request.participation.contest.logo_override_image|camo }}" alt="{{ SITE_NAME }}" height="44" style="border: none"> <img src="{{ request.participation.contest.logo_override_image|camo }}" alt="{{ SITE_NAME }}" height="44" style="border: none">
{% elif request.organization %} {% elif request.organization and request.organization.organization_image %}
<img src="{{ request.organization.organization_image.url|camo }}" alt="{{ SITE_NAME }}" height="44" style="border: none"> <img src="{{ request.organization.organization_image.url|camo }}" alt="{{ SITE_NAME }}" height="44" style="border: none">
{% elif organization_image is defined and organization_image %} {% elif organization_image is defined and organization_image %}
<img src="{{ organization_image.url|camo }}" alt="{{ SITE_NAME }}" height="44" style="border: none"> <img src="{{ organization_image.url|camo }}" alt="{{ SITE_NAME }}" height="44" style="border: none">