2024-05-07 00:59:34 +00:00
|
|
|
from datetime import datetime
|
2015-01-03 14:36:22 +00:00
|
|
|
|
2023-10-19 22:44:24 +00:00
|
|
|
from django.shortcuts import render
|
|
|
|
|
2023-10-20 07:25:55 +00:00
|
|
|
from .supporters.models import Supporter
|
2023-10-19 22:44:24 +00:00
|
|
|
|
|
|
|
|
2015-01-03 14:36:22 +00:00
|
|
|
def view(request):
|
|
|
|
"""Conservancy Sponsors Page view
|
|
|
|
|
|
|
|
Performs object queries necessary to render the sponsors page.
|
|
|
|
"""
|
|
|
|
supporters = Supporter.objects.all().filter(display_until_date__gte=datetime.now())
|
2015-01-03 15:02:02 +00:00
|
|
|
supporters_count = len(supporters)
|
2024-05-07 00:59:34 +00:00
|
|
|
anonymous_count = len(supporters.filter(display_name='Anonymous'))
|
|
|
|
supporters = supporters.exclude(display_name='Anonymous').order_by('ledger_entity_id')
|
2015-01-03 14:36:22 +00:00
|
|
|
c = {
|
2015-01-03 14:53:44 +00:00
|
|
|
'supporters' : supporters,
|
2015-01-03 15:02:02 +00:00
|
|
|
'supporters_count' : supporters_count,
|
2015-01-03 14:53:44 +00:00
|
|
|
'anonymous_count' : anonymous_count
|
2015-01-03 14:36:22 +00:00
|
|
|
}
|
2017-11-03 15:58:24 +00:00
|
|
|
return render(request, "sponsors.html", c)
|