add chercheurs/rechercher.html
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / chercheurs / views.py
CommitLineData
588d6b93 1# -*- encoding: utf-8 -*-
932eef9a
AJ
2from django.shortcuts import render_to_response
3from django.template import Context, RequestContext
4from forms import *
5
6from auf_references_client.models import Discipline, TypeImplantation
7from models import Personne
8
588d6b93 9def repertoire(request):
10 """Mock up du répertoire"""
11 chercheurs = Chercheur.objects.all()
12 variables = { 'chercheurs': chercheurs,
13 }
14 return render_to_response ("chercheurs/repertoire.html", \
15 Context (variables),
16 context_instance = RequestContext(request))
17
932eef9a
AJ
18def inscription(request):
19 if request.method == 'POST':
20 personne_form = PersonneForm (request.POST, prefix="personne")
21 chercheur_form = ChercheurForm (request.POST, prefix="chercheur")
22 if personne_form.is_valid():
23 if chercheur_form.is_valid():
24 p = personne_form.save()
25 c = chercheur_form.save(commit=False)
26 c.personne = p
27 c.save()
28 else:
29 personne_form = PersonneForm(prefix="personne")
30 chercheur_form = ChercheurForm(prefix="chercheur")
31
32 variables = { 'personne_form': personne_form,
33 'chercheur_form': chercheur_form,
34 }
35
36 return render_to_response ("chercheurs/inscription.html", \
37 Context (variables),
38 context_instance = RequestContext(request))
588d6b93 39
da091176 40def perso(request, id):
588d6b93 41 """Mock up de l'espace perso"""
da091176 42 chercheur = Chercheur.objects.get(id=id)
588d6b93 43 variables = { 'chercheur': chercheur,
44 }
45 return render_to_response ("chercheurs/perso.html", \
46 Context (variables),
47 context_instance = RequestContext(request))
da091176 48
49def retrieve(request, id):
50 """Fiche du chercheur"""
51 chercheur = Chercheur.objects.get(id=id)
52 variables = { 'chercheur': chercheur,
53 }
54 return render_to_response ("chercheurs/retrieve.html", \
55 Context (variables),
56 context_instance = RequestContext(request))