Changeset - 462cbc396354
[Not reviewed]
0 2 5
Bradley Kuhn (bkuhn) - 9 years ago 2015-01-03 14:53:12
bkuhn@ebb.org
Supporters list built dynamically.

Hitherto the supporters list has been committed directly to the static
sponsors/index.html file. This was never ideal and a quick hack to
build Conservancy's supporters list at the beginning of the supporters
program.

With this change, a Django app now exists that dynamically generates the
supporters list.

The database rows must be built from Conservancy's internal Ledger file,
which will be done in a separate script.
7 files changed with 49 insertions and 55 deletions:
0 comments (0 inline, 0 general)
www/conservancy/apps/supporters/__init__.py
Show inline comments
 
new file 100644
www/conservancy/apps/supporters/admin.py
Show inline comments
 
new file 100644
 
from django.contrib import admin
 
from models import Supporter
 

	
 
class SupporterAdmin(admin.ModelAdmin):
 
    list_display = ('display_name', 'display_until_date')
 

	
 
admin.site.register(Supporter, SupporterAdmin)
www/conservancy/apps/supporters/models.py
Show inline comments
 
new file 100644
 
from django.db import models
 

	
 
class Supporter(models.Model):
 
    """Conservancy Supporter listing"""
 

	
 
    display_name = models.CharField(max_length=200, blank=False)
 
    display_until_date = models.DateTimeField("date until which this supporter name is displayed")
 
    ledger_entity_id = models.CharField(max_length=200, blank=False)
 

	
 
    def test(self):
 
        return "TESTING"
 
    def __unicode__(self):
 
        return self.display_name
 

	
 
    class Meta:
 
        ordering = ('-ledger_entity_id',)
www/conservancy/apps/supporters/views.py
Show inline comments
 
new file 100644
 
from models import Supporter # relative import
 
from django.views.generic.list_detail import object_list
 
from django.shortcuts import get_object_or_404, render_to_response
 

	
www/conservancy/sponsors.py
Show inline comments
 
new file 100644
 
from django.shortcuts import render_to_response
 
from conservancy.apps.supporters.models import Supporter as Supporter
 
from datetime import datetime, timedelta
 

	
 
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())
 

	
 
    c = {
 
        'supporters' : supporters
 
    }
 
    return render_to_response("sponsors.html", c)
www/conservancy/templates/sponsors.html
Show inline comments
...
 
@@ -36,83 +36,31 @@ any of its sponsors.</p>
 
<li><a href="https://www.samsung.com/"><img src="/img/sponsors/samsung.jpg" height="83" width="250" alt="Samsung" /></a></li>
 
</ul>
 

	
 
<!-- This section will be added when we have in-kind contributions -->
 

	
 
<!-- <h3>In-Kind Donation of Services</h3> -->
 

	
 
<!-- <p>Conservancy would also like to thank the following companies who have -->
 
<!--   donated services and/or resources in-kind to support Conservancy's -->
 
<!--   work.</p> -->
 

	
 
<!-- <ul> -->
 
<!-- </ul> -->
 
<br/>
 
<hr/>
 
<br/>
 
<h2>Supporters</h2>
 

	
 
<p>Conservancy Supporters are individuals who give $120 or more annually as
 
  part of <a href="/supporter/">the Official Conservancy Supporter
 
  program</a>.  Those who request public acknowledgment are listed here in
 
  alphabetical order by surname:</p>
 

	
 
<a id="supporters"></a>
 
   
 
<ul id="supporters">
 
  <li>Aleph Objects, Inc.</li>
 
  <li>Russ Allbery</li>
 
  <li>Jeremy Allison</li>
 
  <li>Christopher Aniszczyk</li>
 
  <li>Anonymous (3 people)</li>
 
  <li>Martin Ansdell-Smith</li>
 
  <li>David Ayers</li>
 
  <li>Jono Bacon</li>
 
  <li>Daniel Callahan</li>
 
  <li>Alison Chaiken</li>
 
  <li>Matthew Daniel</li>
 
  <li>Mark Cohen</li>
 
  <li>Michael Dexter</li>
 
  <li>Aurimas Fiseras</li>
 
  <li>Karl Fogel</li>
 
  <li>Richard Fontana</li>
 
  <li>Timothy Freund</li>
 
  <li>Philippe Gauthier</li>
 
  <li>Scott González</li>
 
  <li>Jared Grubb</li>
 
  <li>Steven Hamilton</li>
 
  <li>Edgar Hill</li>
 
  <li>Karl Ove Hufthammer</li>
 
  <li>Henrik Ingo</li>
 
  <li>maiki interi</li>
 
  <li>Ian Kelling</li>
 
  <li>Tom Kent</li>
 
  <li>Matt Kraai</li>
 
  <li>Johannes Krampf</li>
 
  <li>Cathy Kuhn</li>
 
  <li>Janet Shade Kuhn</li>
 
  <li>Michael Linksvayer</li>
 
  <li>Tom Marble</li>
 
  <li>Darin Miller</li>
 
  <li>Michael Miller</li>
 
  <li>Martin Michlmayr</li>
 
  <li>Pariksheet Nanda</li>
 
  <li>Deborah A. Nicholson</li>
 
  <li>Samuel and Cristine Noble</li>
 
  <li>Donald Robertson</li>
 
  <li>Ivan Sandler</li>
 
  <li>Prabowo Saputro</li>
 
  <li>Christopher Schafer</li>
 
  <li>Richard Schmeidler</li>
 
  <li>Mats Sjöberg</li>
 
  <li>W. John Sullivan</li>
 
  <li>David &rsquo;novalis&rdquo; Turner</li>
 
  <li>Kat Walsh</li>
 
  <li>Christopher Allan Webber</li>
 
  <li>Richard Wheeler</li>
 
  <li>Mark Wielaard</li>
 
  <li>Serge Wroclawski</li>
 
  <li>Seymour Zucker</li>
 
  <li>立思科技藝術有限公司</li>
 
{% for ss in supporters %}
 
<li>{{ ss.display_name|safe }}</li>
 
{% endfor %}
 
</ul>
 

	
 
{% endblock %}
www/conservancy/urls.py
Show inline comments
...
 
@@ -6,33 +6,36 @@
 
# this program under the terms of the GNU Affero General Public License
 
# (AGPL) as published by the Free Software Foundation (FSF), either
 
# version 3 of the License, or (at your option) any later version of the
 
# AGPL published by the FSF.
 
#
 
# This program is distributed in the hope that it will be useful, but
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero
 
# General Public License for more details.
 
#
 
# You should have received a copy of the GNU Affero General Public License
 
# along with this program in a file in the toplevel directory called
 
# "AGPLv3".  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from django.conf.urls.defaults import *
 
from django.contrib import admin
 
from conservancy.feeds import BlogFeed, PressReleaseFeed, OmnibusFeed
 

	
 
handler404 = 'modpythoncustom.view404'
 

	
 
admin.autodiscover()
 

	
 
urlpatterns = patterns('',
 
    (r'^$', 'conservancy.frontpage.view'),
 
    (r'^sponsors$', 'conservancy.frontpage.view'),
 
    (r'^sponsors/$', 'conservancy.sponsors.view'),
 
    (r'^sponsors/index.html$', 'conservancy.sponsors.view'),
 
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
 
    (r'^admin/', admin.site.urls),
 
    (r'^feeds/blog/?$', BlogFeed()),
 
    (r'^feeds/news/?$', PressReleaseFeed()),
 
    (r'^feeds/omnibus/?$', OmnibusFeed()),
 
    (r'^feeds/?$', 'conservancy.feeds.view'),
 
    (r'^news(/|$)', include('conservancy.apps.news.urls')),
 
    (r'^blog(/|$)', include('conservancy.apps.blog.urls')),
 
)
0 comments (0 inline, 0 general)