comparison sat_website/views.py @ 149:b1c16cd53b62

update django to version 1.11, refactor project structure, better PEP-8 compliance
author souliane <souliane@mailoo.org>
date Tue, 17 Oct 2017 04:11:21 +0200
parents d0cd185f9b61
children
comparison
equal deleted inserted replaced
148:75a95a1dfeb6 149:b1c16cd53b62
20 You should have received a copy of the GNU Affero General Public License 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/>. 21 along with Foobar. If not, see <http://www.gnu.org/licenses/>.
22 """ 22 """
23 from django.http import Http404, HttpResponse 23 from django.http import Http404, HttpResponse
24 from django.shortcuts import render_to_response 24 from django.shortcuts import render_to_response
25 from django.core.context_processors import csrf 25 from django.template.context_processors import csrf
26 from django.utils.translation import ugettext_lazy as _ 26 from django.utils.translation import ugettext_lazy as _
27 from django.template import RequestContext
28 from collections import OrderedDict 27 from collections import OrderedDict
29 import datetime
30 import media, social_contract, utils, forms 28 import media, social_contract, utils, forms
29
31 30
32 CATEGORIES = OrderedDict([('frontends', (_(u"Presentation"), 31 CATEGORIES = OrderedDict([('frontends', (_(u"Presentation"),
33 OrderedDict([("features", _(u"Features")), 32 OrderedDict([("features", _(u"Features")),
34 ("frontends", _(u"Frontends")), 33 ("frontends", _(u"Frontends")),
35 ("media", _(u"Screenshots & Videos")), 34 ("media", _(u"Screenshots & Videos")),
75 74
76 def generic_cat(request, category): 75 def generic_cat(request, category):
77 if category in CATEGORIES_ALIASES: 76 if category in CATEGORIES_ALIASES:
78 category = CATEGORIES_ALIASES[category] 77 category = CATEGORIES_ALIASES[category]
79 78
80 context = RequestContext(request, { 79 context = {
81 "available_languages": ['fr', 'en'], 80 "available_languages": ['fr', 'en'],
82 "categories": CATEGORIES, 81 "categories": CATEGORIES,
83 "categories_right": CATEGORIES_RIGHT, 82 "categories_right": CATEGORIES_RIGHT,
84 "category": category, 83 "category": category,
85 "libervia_demo_url": utils.get_libervia_demo_url(), 84 "libervia_demo_url": utils.get_libervia_demo_url(),
86 "subscription_amounts": utils.get_asso_subscr_amounts(), 85 "subscription_amounts": utils.get_asso_subscr_amounts(),
87 }) 86 }
88 87
89 context.update(csrf(request)) 88 context.update(csrf(request))
90 context.update(utils.get_asso_finance_status()) 89 context.update(utils.get_asso_finance_status())
91 90
92 if not category or category == "overview": 91 if not category or category == "overview":