comparison sat_website/views.py @ 0:9305c6458e2f

initial commit
author Goffi <goffi@goffi.org>
date Sat, 28 Jul 2012 20:36:32 +0200
parents
children a49aa1b823f6
comparison
equal deleted inserted replaced
-1:000000000000 0:9305c6458e2f
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 """
5 SàT website: Salut à Toi's presentation website
6 Copyright (C) 2012 Jérôme Poisson (goffi@goffi.org)
7
8 This file is part of SàT website.
9
10 SàT website is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Affero General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 Foobar is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Affero General Public License for more details.
19
20 You should have received a copy of the GNU Affero General Public License
21 along with Foobar. If not, see <http://www.gnu.org/licenses/>.
22 """
23 from django.http import Http404
24 from django.shortcuts import render_to_response
25 from collections import OrderedDict
26 import screenshots, social_contract
27
28 CATEGORIES = OrderedDict([("features", "Features"),
29 ("frontends", "Frontends"),
30 ("screenshots", "Screenshots & Videos"),
31 ("community", "Community"),
32 ("developers", "Developers corner"),
33 ("social_contract", "Social contract")])
34
35 def overview(request):
36 return render_to_response('sat_website/overview.html')
37
38 def generic_cat(request, category):
39 context = {"categories": CATEGORIES,
40 "category": category}
41 for k,v in CATEGORIES.iteritems():
42 print "category: %s:%s" % (k,v)
43 if not category or category == "overview":
44 return render_to_response('sat_website/overview.html', context)
45 elif category == "screenshots":
46 context["screenshots"] = screenshots.screenshots
47 context["screencasts"] = screenshots.screencasts
48 return render_to_response('sat_website/screenshots.html', context)
49 elif category == "social_contract":
50 context["SOCIAL_CONTRACT"] = social_contract.get_social_contract()
51 return render_to_response('sat_website/social_contract.html', context)
52 elif category in CATEGORIES.keys():
53 return render_to_response('sat_website/%s.html' % (category,), context)
54 else:
55 raise Http404