recherche nom prenom
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / chercheurs / forms.py
1 # -*- encoding: utf-8 -*-
2 from django import forms
3 from models import *
4
5
6 class PersonneForm(forms.ModelForm):
7 password = forms.CharField(widget=forms.PasswordInput(), label="Mot de passe")
8 class Meta:
9 model = Utilisateur
10 fields = ('nom', 'prenom', 'courriel', 'password', 'genre')
11
12
13 class ChercheurForm(forms.ModelForm):
14 class Meta:
15 model = Chercheur
16 fields = ('groupes',)
17
18 class PublicationForm(forms.ModelForm):
19 class Meta:
20 model = Publication
21 fields = ('titre', 'annee', 'revue', 'editeur', 'lieu_edition', 'nb_pages', 'url')
22
23 class TheseForm(PublicationForm):
24 titre = forms.CharField(required=True, label="Titre")
25 #def clean_titre(self):
26 # data = self.cleaned_data['titre']
27 # if not data:
28 # raise forms.ValidationError("Vous devez renseigner une thèse")
29 # return data
30
31 class EtablissementForm(forms.ModelForm):
32 class Meta:
33 model = Chercheur
34 fields = ('etablissement',)
35
36 class EtablissementAutreForm(forms.ModelForm):
37 class Meta:
38 model = Chercheur
39 fields = ('etablissement_autre_nom', 'etablissement_autre_pays', )
40
41 class DisciplineForm(forms.ModelForm):
42 class Meta:
43 model = Chercheur
44 fields = ('discipline', 'expertise', 'mots_cles', 'url_site_web', 'url_blog', 'url_facebook', 'url_linkedin')
45
46 class PersonneEditForm(forms.ModelForm):
47 class Meta:
48 model = Personne
49 fields = ('nom', 'prenom', 'genre')
50
51
52 class RepertoireSearchForm (forms.Form):
53 mots_cles = forms.CharField (required = False, label="Mots-clés")
54 discipline = forms.ModelChoiceField(queryset=Discipline.objects.all(), required=False, label="Discipline", empty_label="Tous")
55 fonction = forms.ChoiceField(choices=(('','Tous'),)+FONCTION_CHOICES, required=False, label="Fonction")
56 pays = forms.ModelChoiceField(queryset=Pays.objects.all().order_by("nom"), required=False, label="Localisation", empty_label="Tous")
57 genre = forms.ChoiceField(choices=(('','Tous'),)+GENRE_CHOICES, required=False, label="Genre")