Verified Commit 1f40b6a0 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Use thumbnailer everywhere for partners

parent d8509d2e
{% load thumbnail %}
<section id="partner-banners"> <section id="partner-banners">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
...@@ -6,7 +7,7 @@ ...@@ -6,7 +7,7 @@
<a href="{% url "partners:partner" partner.slug %}"> <a href="{% url "partners:partner" partner.slug %}">
<img class="animated zoomIn image text-hide" <img class="animated zoomIn image text-hide"
alt="Logo {{ partner.name }}" alt="Logo {{ partner.name }}"
src="{{ partner.logo.url }}"/> src="{% thumbnail partner.logo thumb_size fit=False %}"/>
</a> </a>
</div> </div>
{% endfor %} {% endfor %}
......
{% extends 'base.html' %} {% extends 'base.html' %}
{% load i18n bleach_tags partner_cards %} {% load i18n bleach_tags partner_cards thumbnail %}
{% block title %}{% trans "Partners" %} — {% trans "Career" %} — {{ block.super }}{% endblock %} {% block title %}{% trans "Partners" %} — {% trans "Career" %} — {{ block.super }}{% endblock %}
{% block opengraph_title %}{% trans "Partners" %} — {% trans "Career" %} — {{ block.super }}{% endblock %} {% block opengraph_title %}{% trans "Partners" %} — {% trans "Career" %} — {{ block.super }}{% endblock %}
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<div class="row mt-4"> <div class="row mt-4">
<div class="col-12 col-md-4 d-flex align-items-center"> <div class="col-12 col-md-4 d-flex align-items-center">
<img src="{{ main_partner.logo.url }}"/> <img src="{% thumbnail main_partner.logo THUMBNAIL_SIZE_MEDIUM fit=False %}"/>
</div> </div>
<div class="col-12 col-md-8 mt-3 mt-md-0"> <div class="col-12 col-md-8 mt-3 mt-md-0">
<h2>{% trans "Main Partner" %}</h2> <h2>{% trans "Main Partner" %}</h2>
......
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n bleach_tags google_map_url compress partner_cards static %} {% load i18n bleach_tags google_map_url thumbnail compress partner_cards static %}
{% block title %}{{ partner.name }} — {% trans "Partners" %} — {% trans "Career" %} — {{ block.super }}{% endblock %} {% block title %}{{ partner.name }} — {% trans "Partners" %} — {% trans "Career" %} — {{ block.super }}{% endblock %}
{% block opengraph_title %}{{ partner.name }} — {% trans "Partners" %} — {% trans "Career" %} — {% block opengraph_title %}{{ partner.name }} — {% trans "Partners" %} — {% trans "Career" %} —
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<div class="row"> <div class="row">
<div class="col-12 col-md-4"> <div class="col-12 col-md-4">
<img src="{{ partner.logo.url }}" alt="Logo {{ partner.name }}"/> <img src="{% thumbnail partner.logo THUMBNAIL_SIZE_MEDIUM fit=False %}" alt="Logo {{ partner.name }}"/>
<h4 class="mt-4 text-center text-md-left">{% trans "Address" %}</h4> <h4 class="mt-4 text-center text-md-left">{% trans "Address" %}</h4>
<p class="text-center text-md-left"> <p class="text-center text-md-left">
......
from random import sample from random import sample
from django import template from django import template
from django.conf import settings
from partners.models import Partner from partners.models import Partner
...@@ -26,5 +27,6 @@ def render_partner_banners(context): ...@@ -26,5 +27,6 @@ def render_partner_banners(context):
request.session['partner_sequence'] = rest + chosen request.session['partner_sequence'] = rest + chosen
return { return {
'partners': [p for p in all_partners if p.id in chosen] 'partners': [p for p in all_partners if p.id in chosen],
'thumb_size': settings.THUMBNAIL_SIZES['small']
} }
...@@ -13,7 +13,8 @@ register = template.Library() ...@@ -13,7 +13,8 @@ register = template.Library()
def partner_card(partner): def partner_card(partner):
image_url = '' image_url = ''
if partner.logo: if partner.logo:
image_url = partner.logo.url image_url = thumbnail(partner.logo, settings.THUMBNAIL_SIZES['medium'],
fit=False)
meta_text = truncatechars(bleach(striptags(partner.company_profile)), 80) meta_text = truncatechars(bleach(striptags(partner.company_profile)), 80)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment