Skip to content

Commit 4d37dfe

Browse files
committed
cache eache sponsor placement separately
1 parent 9dbed05 commit 4d37dfe

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

templates/sponsors/partials/sponsors-list.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
{% load thumbnail %}
22
{% load cache %}
33

4-
{% comment %}cache for 1 day{% endcomment %}
5-
{% cache 86400 CACHED_SPONSORS_LIST %}
64

75
{% if logo_place == "download" %}
6+
{% comment %}cache for 1 day{% endcomment %}
7+
{% cache 86400 CACHED_DOWNLOAD_SPONSORS_LIST %}
88
<h2 class="widget-title">Sponsors</h2>
99
<p>Visionary sponsors help to host Python downloads.</p>
1010
{% for sponsorship in sponsorships %}
1111
{% thumbnail sponsorship.sponsor.web_logo "x200" format="PNG" quality=100 as im %}
1212
<img src="{{ im.url }}" alt="{{ sponsorship.sponsor.name }} logo" style="max-height:200px;max-width:200px;height:auto;width:auto;">
1313
{% endthumbnail %}
1414
{% endfor %}
15+
{% endcache CACHED_DOWNLOAD_SPONSORS_LIST %}
1516

1617
{% elif logo_place == "jobs" %}
18+
{% comment %}cache for 1 day{% endcomment %}
19+
{% cache 86400 CACHED_JOBS_SPONSORS_LIST %}
1720
<h3 class="widget-title">Job Board Sponsors</h3>
1821
<div style="display: grid; grid-gap: 1em; grid-template-columns: repeat(auto-fit, minmax(100px, 0fr)); grid-template-rows: repeat(1, minmax(50px, 0fr)); align-items: center; justify-content: center; margin-top: 1em;">
1922
{% for sponsorship in sponsorships %}
@@ -24,8 +27,11 @@ <h3 class="widget-title">Job Board Sponsors</h3>
2427
{% endthumbnail %}
2528
{% endfor %}
2629
</div>
30+
{% endcache CACHED_JOBS_SPONSORS_LIST %}
2731

2832
{% elif logo_place == "sponsors" %}
33+
{% comment %}cache for 1 day{% endcomment %}
34+
{% cache 86400 CACHED_SPONSORS_LIST %}
2935

3036
{% for package, placement_info in sponsorships_by_package.items %}
3137
{% if placement_info.sponsorships %}
@@ -54,5 +60,5 @@ <h1 style="font-size: {% if forloop.first %}350%{% else %}300%{% endif %}">{{ pa
5460
</div>
5561
{% endif %}
5662
{% endfor %}
57-
{% endif %}
5863
{% endcache CACHED_SPONSORS_LIST %}
64+
{% endif %}

0 commit comments

Comments
 (0)