From e45322d3c93e043111c865d04687a4fee58589e5 2015-01-03 15:02:02
From: Bradley M. Kuhn
Date: 2015-01-03 15:02:02
Subject: [PATCH] Place Supporters counter on front & sponsors pages
The number of current supporters now appears on the frontpage and the
sponsors page.
---
diff --git a/www/conservancy/frontpage.py b/www/conservancy/frontpage.py
index a35ddeb09a434118ee1fe912c30d3550fe18ba6a..c89fcf0f5d9c90f5876bce31979e91048ba3ff93 100644
--- a/www/conservancy/frontpage.py
+++ b/www/conservancy/frontpage.py
@@ -1,4 +1,5 @@
from django.shortcuts import render_to_response
+from conservancy.apps.supporters.models import Supporter as Supporter
from conservancy.apps.news.models import PressRelease
from conservancy.apps.blog.models import Entry as BlogEntry
from datetime import datetime, timedelta
@@ -9,11 +10,13 @@ def view(request):
Performs all object queries necessary to render the front page.
"""
+ supporters_count = len(Supporter.objects.all().filter(display_until_date__gte=datetime.now()))
press_releases = PressRelease.objects.all().filter(pub_date__lte=datetime.now(), sites=2)[:5]
blog = BlogEntry.objects.all().filter(pub_date__lte=datetime.now())[:3]
c = {
'press_releases': press_releases,
+ 'supporters_count': supporters_count,
'blog' : blog
}
return render_to_response("frontpage.html", c)
diff --git a/www/conservancy/sponsors.py b/www/conservancy/sponsors.py
index 1d4e88dc8d76d82b88313aa2fae889b3e873b24e..326a6d0b2fb122ef99e9a85c6526839bb402ecd8 100644
--- a/www/conservancy/sponsors.py
+++ b/www/conservancy/sponsors.py
@@ -9,11 +9,13 @@ def view(request):
"""
supporters = Supporter.objects.all().filter(display_until_date__gte=datetime.now())
+ supporters_count = len(supporters)
anonymous_count = len(supporters.filter(display_name = 'Anonymous'))
supporters = supporters.exclude(display_name = 'Anonymous')
c = {
'supporters' : supporters,
+ 'supporters_count' : supporters_count,
'anonymous_count' : anonymous_count
}
return render_to_response("sponsors.html", c)
diff --git a/www/conservancy/templates/frontpage.html b/www/conservancy/templates/frontpage.html
index d0c1804785e6182340f63ada02f86cbd10d7f276..ec033672a486511a1746bd1901d763e6a32bd906 100644
--- a/www/conservancy/templates/frontpage.html
+++ b/www/conservancy/templates/frontpage.html
@@ -36,7 +36,7 @@
Support Conservancy
As a 501(c)(3) non-profit organization, Conservancy relies on
charitable donations for its operations.
- Please become a Conservancy support
+ Please join {{supporters_count|safe}} others and become a Conservancy support
today and/or donate generously to help our work!
Follow Conservancy News & Blogs
diff --git a/www/conservancy/templates/sponsors.html b/www/conservancy/templates/sponsors.html
index bdcdecd15b23052533cf11e6a4afd1c95c82bc66..a0676a886906d283817af7fbc54a71fde1918788 100644
--- a/www/conservancy/templates/sponsors.html
+++ b/www/conservancy/templates/sponsors.html
@@ -51,7 +51,8 @@ any of its sponsors.
Supporters
-Conservancy Supporters are individuals who give $120 or more annually as
+
Conservancy currently has {{supporters_count|safe}} Supporters.
+ Conservancy Supporters are individuals who give $120 or more annually as
part of the Official Conservancy Supporter
program. Those who request public acknowledgment are listed here in
alphabetical order by surname: