comparison hgscm/apps/www/views.py @ 78:8d25e34c21c2

templatetags: Add DownloadButton tag to display a download button according to operating system This is somewhat a hacky way to do it, but it works, and we might redo it alter on.
author David Soria Parra <dsp@php.net>
date Fri, 20 Feb 2009 15:12:43 +0100
parents 9be94f3dcaa0
children d4b03ef491f2
comparison
equal deleted inserted replaced
77:fb737a306703 78:8d25e34c21c2
5 from django.conf import settings 5 from django.conf import settings
6 from hgscm.apps.www.models import get_download, get_latest_version 6 from hgscm.apps.www.models import get_download, get_latest_version
7 import os 7 import os
8 8
9 def frontpage(request): 9 def frontpage(request):
10 return render_to_response("frontpage.html", { 'latest_version': get_latest_version() }, 10 return render_to_response("frontpage.html", { },
11 RequestContext(request)) 11 RequestContext(request))
12 def about(request): 12 def about(request):
13 return render_to_response("about.html", { }, 13 return render_to_response("about.html", { },
14 RequestContext(request)) 14 RequestContext(request))
15 def thepage(request): 15 def thepage(request):
16 return render_to_response("thepage.html", { }, 16 return render_to_response("thepage.html", { },
17 RequestContext(request)) 17 RequestContext(request))
18 def download(request, platform, version): 18 def download(request, platform, version):
19 return HttpResponseRedirect(get_download(platform, version)) 19 return HttpResponseRedirect(get_download(platform, version)['url'])
20 def downloads(request): 20 def downloads(request):
21 f = open(os.path.join(settings.MEDIA_ROOT, "downloads.json")) 21 f = open(os.path.join(settings.MEDIA_ROOT, "downloads.json"))
22 list = simplejson.load(f) 22 list = simplejson.load(f)
23 f.close() 23 f.close()
24 return render_to_response("downloads.html", {'downloads': list}, 24 return render_to_response("downloads.html", {'downloads': list},