From: Magnus Hagander Date: Wed, 30 Jan 2013 13:28:16 +0000 (+0100) Subject: Actually implement a way to look at older events (events archive) X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=2cad1799ed9cbc787b5c90dea1c3291bb249f67a;p=pgweb.git 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. --- diff --git a/pgweb/events/models.py b/pgweb/events/models.py index d1b4daa6..3c09697b 100644 --- a/pgweb/events/models.py +++ b/pgweb/events/models.py @@ -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 '/$' diff --git a/pgweb/events/views.py b/pgweb/events/views.py index 02edabc4..10be0b38 100644 --- a/pgweb/events/views.py +++ b/pgweb/events/views.py @@ -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: diff --git a/pgweb/urls.py b/pgweb/urls.py index 2bdd0085..0d7f8770 100644 --- a/pgweb/urls.py +++ b/pgweb/urls.py @@ -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'), diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py index e83ddaca..a106f9d5 100644 --- a/pgweb/util/contexts.py +++ b/pgweb/util/contexts.py @@ -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/'}, ], diff --git a/templates/events/archive.html b/templates/events/archive.html index 96873f60..289a93e2 100644 --- a/templates/events/archive.html +++ b/templates/events/archive.html @@ -1,10 +1,11 @@ {%extends "base/page.html"%} {%load markup%} -{%block title%}Event archive{%endblock%} +{%block title%}{{title}}{%endblock%} {%block contents%} +

{{title}}

{%for eventblock in eventblocks%} -

{{eventblock.name}}

+{%if eventblocks|length > 1%}

{{eventblock.name}}

{%endif%}

Note: 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. {{event.summary|markdown:"safe"}}

{%endfor%} +{%if not archive%} +

Older {{eventblock.name}}

+{%endif%} {%endfor%} +{%if not archive%}

Submit event

+{%endif%} {%endblock%} diff --git a/templates/index.html b/templates/index.html index 4be59e1c..150f30d9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -140,7 +140,7 @@ of bugs in previous releases.,
- + Upcoming Events
@@ -151,7 +151,7 @@ of bugs in previous releases.,

{% endfor %}
- + Upcoming training
@@ -166,7 +166,7 @@ of bugs in previous releases., {{trainingcompanies|slice:":2"|join:", "}} and others. {%endif%} {%endif%} -

Take a look at our schedule to find the training that you want.

+

Take a look at our schedule to find the training that you want.

{%else%} There are no training events currently scheduled. {%endif%} @@ -175,7 +175,7 @@ of bugs in previous releases.,