Mercurial > hg-website
diff hgscm/apps/www/views.py @ 70:bef09338eceb
downloads: add initial handling for downloads
We are using json as a format to store our download information
as the format is rather simple and can be parsed without problems
and dependencies.
author | David Soria Parra <dsp@php.net> |
---|---|
date | Wed, 18 Feb 2009 15:32:57 +0100 |
parents | 57ece5687f92 |
children | 9be94f3dcaa0 |
line wrap: on
line diff
--- a/hgscm/apps/www/views.py Wed Feb 18 09:01:30 2009 +0100 +++ b/hgscm/apps/www/views.py Wed Feb 18 15:32:57 2009 +0100 @@ -1,8 +1,11 @@ from django.shortcuts import render_to_response from django.template import RequestContext +from django.http import HttpResponseRedirect +from django.utils import simplejson +from apps.www.models import get_download, get_latest_version def frontpage(request): - return render_to_response("frontpage.html", { }, + return render_to_response("frontpage.html", { 'latest_version': get_latest_version() }, RequestContext(request)) def about(request): return render_to_response("about.html", { }, @@ -10,3 +13,11 @@ def thepage(request): return render_to_response("thepage.html", { }, RequestContext(request)) +def download(request, platform, version): + return HttpResponseRedirect(get_download(platform, version)) +def downloads(request): + f = open("downloads.json") + list = simplejson.load(f) + f.close() + return render_to_response("downloads.html", {'downloads': list}, + RequestContext(request))