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