diff options
author | Dan McGee <dan@archlinux.org> | 2012-02-22 22:54:53 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-02-22 22:54:53 -0600 |
commit | c7eca65692ab721348a504ffaa7d468141c10846 (patch) | |
tree | e4214c61ae4e2d819468f2f2928e99a5c6ab48c5 /retro/views.py | |
parent | 85a215e158e8631999dcbb45688adfa040767778 (diff) | |
parent | f451e61725214337253f826ec62800ef7faa4995 (diff) |
Merge branch 'retro'
Diffstat (limited to 'retro/views.py')
-rw-r--r-- | retro/views.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/retro/views.py b/retro/views.py new file mode 100644 index 00000000..5ce6d19d --- /dev/null +++ b/retro/views.py @@ -0,0 +1,33 @@ +from django.conf import settings +from django.http import Http404 +from django.views.decorators.cache import cache_page +from django.views.generic.simple import direct_to_template + + +RETRO_YEAR_MAP = { + 2002: 'index-20020328.html', + 2003: 'index-20030330.html', + 2004: 'index-20040327.html', + 2005: 'index-20050328.html', + 2006: 'index-20060328.html', + 2007: 'index-20070324.html', + 2008: 'index-20080311.html', + 2009: 'index-20090327.html', + 2010: 'index-20100208.html', + 2011: 'index-20110212.html', +} + + +@cache_page(1800) +def retro_homepage(request, year): + year = int(year) + template = RETRO_YEAR_MAP.get(year, None) + if template is None: + raise Http404 + static_url = '%s%d/' % (settings.STATIC_URL, year) + context = { + 'RETRO_STATIC_URL': static_url, + } + return direct_to_template(request, 'retro/%s' % template, context) + +# vim: set ts=4 sw=4 et: |