Corrections pour backend 0.2
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage_django / savoirs / views.py
CommitLineData
d15017b2
CR
1# -*- encoding: utf-8 -*-
2import datetime
3from django.shortcuts import render_to_response
4from django.template import Context, RequestContext
5from models import Actualite
6from savoirs import configuration
7from recherche import cherche
8
9def index (request):
10 delta = datetime.timedelta (days = 90)
11 oldest = datetime.date.today () - delta
12 articles = Actualite.objects.filter (visible = '1', date__gt = oldest)
13 articles = articles[0:configuration['accueil_actualite']]
14 return render_to_response ("index.html", \
15 Context ({"articles": articles}), \
16 context_instance = RequestContext(request))
17
18def recherche (request):
19 results = None
20 q = request.GET.get("q", "")
21 page = int(request.GET.get("page", 0))
22
40a5ebfb 23 r = cherche (page, q)
d15017b2
CR
24
25 return render_to_response ("recherche.html", \
26 Context ({'q': q,
27 'page': page,
28 'data': r}), \
29 context_instance = RequestContext(request))
30
31def conseils (request):
32 return render_to_response ("conseils.html", \
33 Context (), \
34 context_instance = RequestContext(request))
35
36def a_propos (request):
37 return render_to_response ("a-propos.html", \
38 Context (), \
39 context_instance = RequestContext(request))
40
41def nous_contacter (request):
42 return render_to_response ("contact.html", \
43 Context (), \
44 context_instance = RequestContext(request))