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() | |
12 | variables = { 'chercheurs': chercheurs, | |
13 | } | |
14 | return render_to_response ("chercheurs/repertoire.html", \ | |
15 | Context (variables), | |
16 | context_instance = RequestContext(request)) | |
17 | ||
932eef9a AJ |
18 | def 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 | |
40 | def perso(request, ID): | |
41 | """Mock up de l'espace perso""" | |
42 | chercheur = None #Chercheur.objects.get(id=id) | |
43 | variables = { 'chercheur': chercheur, | |
44 | } | |
45 | return render_to_response ("chercheurs/perso.html", \ | |
46 | Context (variables), | |
47 | context_instance = RequestContext(request)) |