From 48f51dea411885e510cb9aa2887e83be289232f6 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 2 Feb 2012 14:12:46 -0600 Subject: Add a retro site view and link it to a URL This is from our friends at web.archive.org, who's earliest capture of the Arch Linux website was on March 28, 2002. Seems like something nice to do around the 10th anniversary of the website being up and the distro being around, and not hotlinking their servers also seems like a good idea. Signed-off-by: Dan McGee --- retro/views.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 retro/views.py (limited to 'retro/views.py') diff --git a/retro/views.py b/retro/views.py new file mode 100644 index 00000000..ba1109b0 --- /dev/null +++ b/retro/views.py @@ -0,0 +1,19 @@ +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', +} + + +@cache_page(1800) +def retro_homepage(request, year): + year = int(year) + template = RETRO_YEAR_MAP.get(year, None) + if template is None: + raise Http404 + return direct_to_template(request, 'retro/%s' % template, {}) + +# vim: set ts=4 sw=4 et: -- cgit v1.2.3-2-g168b From f451e61725214337253f826ec62800ef7faa4995 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 18 Feb 2012 20:40:15 -0600 Subject: Add retro views from 2003 through 2011 These follow the prior commit adding the framework and an initial 2002 retro view. Signed-off-by: Dan McGee --- retro/views.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'retro/views.py') diff --git a/retro/views.py b/retro/views.py index ba1109b0..5ce6d19d 100644 --- a/retro/views.py +++ b/retro/views.py @@ -1,3 +1,4 @@ +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 @@ -5,6 +6,15 @@ 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', } @@ -14,6 +24,10 @@ def retro_homepage(request, year): template = RETRO_YEAR_MAP.get(year, None) if template is None: raise Http404 - return direct_to_template(request, 'retro/%s' % template, {}) + 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: -- cgit v1.2.3-2-g168b