SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit ebce9765 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add recent past (last year) sponsors in grid

fixes #235
parent 4eabca45
No related branches found
No related tags found
No related merge requests found
......@@ -93,27 +93,43 @@
{% endfor %}
</div>
<h3 class="highlight">&euro;10k and above:</h3>
<h3 class="highlight mt-4">&euro;10k and above:</h3>
<div class="d-grid gap-3" style="grid-template-columns: repeat(3, minmax(0, 1fr));">
{% for sponsor in sponsors_10kplus %}
{% include 'sponsors/_sponsor_card.html' with sponsor=sponsor %}
{% endfor %}
</div>
<h3 class="highlight">&euro;5k and above:</h3>
<h3 class="highlight mt-4">&euro;5k and above:</h3>
<div class="d-grid gap-3" style="grid-template-columns: repeat(3, minmax(0, 1fr));">
{% for sponsor in sponsors_5kplus %}
{% include 'sponsors/_sponsor_card.html' with sponsor=sponsor %}
{% endfor %}
</div>
<h3 class="highlight">Our other current Sponsors:</h3>
<h3 class="highlight mt-4">Our other current Sponsors:</h3>
<div class="d-grid gap-3" style="grid-template-columns: repeat(3, minmax(0, 1fr));">
{% for sponsor in current_sponsors %}
{% include 'sponsors/_sponsor_card.html' with sponsor=sponsor %}
{% endfor %}
</div>
<h1 class="highlight">Our recent-past Sponsors</h1>
<hgroup class="p-2 highlight d-flex align-items-center justify-content-between">
<h3 class="m-0">
Last year's Sponsors:
</h3>
<span class="text-muted">
(excludes current sponsors)
</span>
</hgroup>
<div class="d-grid gap-3" style="grid-template-columns: repeat(3, minmax(0, 1fr));">
{% for sponsor in last_year_sponsors %}
{% include 'sponsors/_sponsor_card.html' with sponsor=sponsor %}
{% endfor %}
</div>
</div>
</div>
......
......@@ -2,6 +2,7 @@ __copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__ = "AGPL v3"
import datetime
from django.shortcuts import render
from organizations.models import Organization
......@@ -14,10 +15,20 @@ def sponsors(request):
current_sponsors = (
Organization.objects.current_sponsors().with_subsidy_above_and_up_to(0, 5000)
)
last_year_sponsors = (
Organization.objects.all_sponsors()
.filter(
subsidy__date_until__year__lte=datetime.date.today().year - 1,
subsidy__date_until__gt=datetime.date.today()
- datetime.timedelta(days=365),
)
.exclude(pk__in=current_sponsors.values_list("pk", flat=True))
)
context = {
"sponsors_20kplus": sponsors_20kplus,
"sponsors_10kplus": sponsors_10kplus,
"sponsors_5kplus": sponsors_5kplus,
"current_sponsors": current_sponsors.order_by_total_amount_received(),
"last_year_sponsors": last_year_sponsors.order_by_total_amount_received(),
}
return render(request, "sponsors/sponsors.html", context)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment