Actually implement a way to look at older events (events archive)

This also changes the main URL to look at events to be /about/events/
instead of /about/eventsarchive/, and reuses /about/eventsarchive/ to
be the actual achive. Also separates out the training archive to it's
own page at /about/eventsarchive/training/, for easier browsing.
This commit is contained in:
Magnus Hagander
2013-01-30 14:28:16 +01:00
parent 5055c330c7
commit 2cad1799ed
6 changed files with 37 additions and 11 deletions

View File

@ -27,7 +27,7 @@ class Event(PgModel, models.Model):
def purge_urls(self):
yield '/about/event/%s/' % self.pk
yield '/about/eventarchive/'
yield '/about/events/'
yield '/events.rss'
# FIXME: when to expire the front page?
yield '/$'

View File

@ -12,16 +12,34 @@ from pgweb.util.helpers import simple_form
from models import Event
from forms import EventForm
def archive(request, paging=None):
def main(request):
events = Event.objects.select_related('country').filter(approved=True).filter(training=False, enddate__gt=date.today).order_by('enddate', 'startdate',)
training = Event.objects.select_related('country').filter(approved=True).filter(training=True, enddate__gt=date.today).order_by('enddate', 'startdate',)
return render_to_response('events/archive.html', {
'title': 'Current events',
'eventblocks': (
{ 'name': 'Events', 'events': events, },
{ 'name': 'Training', 'events': training, },
{ 'name': 'Events', 'events': events, 'link': '',},
{ 'name': 'Training', 'events': training, 'link': 'training/',},
),
}, NavContext(request, 'about'))
def _eventarchive(request, training, title):
# Hardcode to the latest 100 events. Do we need paging too?
events = Event.objects.select_related('country').filter(approved=True).filter(training=training, enddate__lte=date.today).order_by('-enddate', '-startdate',)[:100]
return render_to_response('events/archive.html', {
'title': '%s Archive' % title,
'archive': True,
'eventblocks': (
{'name': title, 'events': events, },
),
}, NavContext(request, 'about'))
def archive(request):
return _eventarchive(request, False, 'Event')
def trainingarchive(request):
return _eventarchive(request, True, 'Training')
def item(request, itemid, throwaway=None):
event = get_object_or_404(Event, pk=itemid)
if not event.approved:

View File

@ -27,7 +27,9 @@ urlpatterns = patterns('',
(r'^about/newsarchive/$', 'news.views.archive'),
(r'^about/news/(\d+)(-.*)?/$', 'news.views.item'),
(r'^about/events/$', 'events.views.main'),
(r'^about/eventarchive/$', 'events.views.archive'),
(r'^about/eventarchive/training/$', 'events.views.trainingarchive'),
(r'^about/event/(\d+)(-.*)?/$', 'events.views.item'),
(r'^about/featurematrix/$', 'featurematrix.views.root'),
(r'^about/featurematrix/detail/(\d+)/$', 'featurematrix.views.detail'),

View File

@ -17,7 +17,7 @@ sitenav = {
{'title': 'Servers', 'link': '/about/servers/'},
]},
{'title': 'Latest news', 'link':'/about/newsarchive/'},
{'title': 'Upcoming events', 'link':'/about/eventarchive/'},
{'title': 'Upcoming events', 'link':'/about/events/'},
{'title': 'Press', 'link':'/about/press/'},
{'title': 'Licence', 'link':'/about/licence/'},
],

View File

@ -1,10 +1,11 @@
{%extends "base/page.html"%}
{%load markup%}
{%block title%}Event archive{%endblock%}
{%block title%}{{title}}{%endblock%}
{%block contents%}
<h1>{{title}}</h1>
{%for eventblock in eventblocks%}
<h1><a name="{{eventblock.name}}">{{eventblock.name}}</a></h1>
{%if eventblocks|length > 1%}<h2><a name="{{eventblock.name}}">{{eventblock.name}}</a></h2>{%endif%}
<p>
<i><b>Note:</b> The PostgreSQL Global Development Group does not endorse any
events run by third parties. No guarantee of the quality of events is offered
@ -18,8 +19,13 @@ whatsoever.</i>
{{event.summary|markdown:"safe"}}
</p>
{%endfor%}
{%if not archive%}
<p><a href="/about/eventarchive/{{eventblock.link}}">Older {{eventblock.name}}</a></p>
{%endif%}
{%endfor%}
{%if not archive%}
<p><a href="/account/events/new/">Submit event</a></p>
{%endif%}
{%endblock%}

View File

@ -140,7 +140,7 @@ of bugs in previous releases.,
</div> <!-- pgFrontPlanetWrap -->
</div> <!-- pgFrontPlanet -->
<div id="pgFrontEvents" class="txtNewsEvent">
<a href="/about/eventarchive">
<a href="/about/events/">
<img src="/media/img/hdr/hdr_upcomingevents.png" width="123" height="10" alt="Upcoming Events" />
</a>
<div class="pgNewsEventsWrap">
@ -151,7 +151,7 @@ of bugs in previous releases.,
</p>
{% endfor %}
</div>
<a href="/about/eventarchive">
<a href="/about/events/">
<img src="/media/img/hdr/hdr_upcomingtraining.png" width="140" height="10" alt="Upcoming training" />
</a>
<div class="pgNewsEventsWrap">
@ -166,7 +166,7 @@ of bugs in previous releases.,
{{trainingcompanies|slice:":2"|join:", "}} and others.
{%endif%}
{%endif%}
<p>Take a look at our <a href="/about/eventarchive/#Training">schedule</a> to find the training that you want.</p>
<p>Take a look at our <a href="/about/events/#Training">schedule</a> to find the training that you want.</p>
{%else%}
There are no training events currently scheduled.
{%endif%}
@ -175,7 +175,7 @@ of bugs in previous releases.,
<img class="pgArrowImage" src="/media/img/layout/blt_blu_arrow.png" width="6" height="5" alt="" />
<ul class="pgRSSBottomList">
<li>
<a href="/about/eventarchive" title="More Events">More</a>
<a href="/about/events/" title="More Events">More</a>
</li>
<li>
<a href="/account/events/new/">Submit Event</a>