Mercurial > sat_legacy_website
annotate sat_website/views.py @ 15:b76ca5137041
added 6th presentation video (command export)
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 25 Feb 2013 20:55:08 +0100 |
parents | d42dd630476f |
children | eda4deefecd1 |
rev | line source |
---|---|
0 | 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 | |
2
0df46e87537d
i18n: marked translatable texts + add change language form on pages footer
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
25 from django.core.context_processors import csrf |
0df46e87537d
i18n: marked translatable texts + add change language form on pages footer
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
26 from django.utils.translation import ugettext_lazy as _ |
0 | 27 from collections import OrderedDict |
1
a49aa1b823f6
added SàT archive download link (detect the last version)
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
28 import screenshots, social_contract, utils |
0 | 29 |
4 | 30 CATEGORIES = OrderedDict([("features", _(u"Features")), |
31 ("frontends", _(u"Frontends")), | |
32 ("screenshots", _(u"Screenshots & Videos")), | |
33 ("community", _(u"Community")), | |
34 ("developers", _(u"Developers corner")), | |
35 ("social_contract", _(u"Social contract"))]) | |
0 | 36 |
37 def overview(request): | |
38 return render_to_response('sat_website/overview.html') | |
39 | |
40 def generic_cat(request, category): | |
1
a49aa1b823f6
added SàT archive download link (detect the last version)
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
41 latest_dl_path, latest_version = utils.get_latest_sat() |
2
0df46e87537d
i18n: marked translatable texts + add change language form on pages footer
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
42 context = { |
0df46e87537d
i18n: marked translatable texts + add change language form on pages footer
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
43 "available_languages": ['fr', 'en'], |
0df46e87537d
i18n: marked translatable texts + add change language form on pages footer
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
44 "categories": CATEGORIES, |
1
a49aa1b823f6
added SàT archive download link (detect the last version)
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
45 "category": category, |
a49aa1b823f6
added SàT archive download link (detect the last version)
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
46 "latest_dl_path": latest_dl_path, |
a49aa1b823f6
added SàT archive download link (detect the last version)
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
47 "latest_version": latest_version, |
a49aa1b823f6
added SàT archive download link (detect the last version)
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
48 } |
2
0df46e87537d
i18n: marked translatable texts + add change language form on pages footer
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
49 context.update(csrf(request)) |
0df46e87537d
i18n: marked translatable texts + add change language form on pages footer
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
50 |
0 | 51 if not category or category == "overview": |
52 return render_to_response('sat_website/overview.html', context) | |
53 elif category == "screenshots": | |
54 context["screenshots"] = screenshots.screenshots | |
55 context["screencasts"] = screenshots.screencasts | |
56 return render_to_response('sat_website/screenshots.html', context) | |
57 elif category == "social_contract": | |
58 context["SOCIAL_CONTRACT"] = social_contract.get_social_contract() | |
59 return render_to_response('sat_website/social_contract.html', context) | |
60 elif category in CATEGORIES.keys(): | |
61 return render_to_response('sat_website/%s.html' % (category,), context) | |
62 else: | |
63 raise Http404 |