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.
This commit is contained in:
parent
8e43cfd128
commit
462cbc3963
7 changed files with 49 additions and 55 deletions
0
www/conservancy/apps/supporters/__init__.py
Normal file
0
www/conservancy/apps/supporters/__init__.py
Normal file
7
www/conservancy/apps/supporters/admin.py
Normal file
7
www/conservancy/apps/supporters/admin.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
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)
|
16
www/conservancy/apps/supporters/models.py
Normal file
16
www/conservancy/apps/supporters/models.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
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',)
|
4
www/conservancy/apps/supporters/views.py
Normal file
4
www/conservancy/apps/supporters/views.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
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
|
||||||
|
|
16
www/conservancy/sponsors.py
Normal file
16
www/conservancy/sponsors.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
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)
|
|
@ -57,62 +57,10 @@ any of its sponsors.</p>
|
||||||
alphabetical order by surname:</p>
|
alphabetical order by surname:</p>
|
||||||
|
|
||||||
<a id="supporters"></a>
|
<a id="supporters"></a>
|
||||||
|
|
||||||
<ul id="supporters">
|
<ul id="supporters">
|
||||||
<li>Aleph Objects, Inc.</li>
|
{% for ss in supporters %}
|
||||||
<li>Russ Allbery</li>
|
<li>{{ ss.display_name|safe }}</li>
|
||||||
<li>Jeremy Allison</li>
|
{% endfor %}
|
||||||
<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 ’novalis” 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>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -27,6 +27,9 @@ admin.autodiscover()
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
(r'^$', 'conservancy.frontpage.view'),
|
(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/doc/', include('django.contrib.admindocs.urls')),
|
||||||
(r'^admin/', admin.site.urls),
|
(r'^admin/', admin.site.urls),
|
||||||
(r'^feeds/blog/?$', BlogFeed()),
|
(r'^feeds/blog/?$', BlogFeed()),
|
||||||
|
|
Loading…
Reference in a new issue