mots_cles = forms.CharField (required = False, label="Mots-clés")
discipline = forms.ModelChoiceField(queryset=Discipline.objects.all(), required=False, label="Discipline", empty_label="Tous")
domaine = forms.ModelChoiceField(queryset=Groupe.objects.all(), required=False, label="Domaine de recherche", empty_label="Tous")
- #fonction = forms.ChoiceField(choices=(('','Tous'),)+FONCTION_CHOICES, required=False, label="Fonction")
+ fonction = forms.ChoiceField(choices=(('','Tous'),('chercheur','Chercheur'), ('enseignant','Enseignant-Chercheur'), ('expert','Expert')), required=False, label="Fonction")
pays = forms.ModelChoiceField(queryset=Pays.objects.all().order_by("nom"), required=False, label="Localisation", empty_label="Tous")
class SendPasswordForm(forms.Form):
mots_cles = simpleForm.cleaned_data["mots_cles"]
if mots_cles:
list = list.search(mots_cles)
+ fonction = simpleForm.cleaned_data["fonction"]
+ if fonction:
+ if fonction == "enseignant":
+ list = list.filter(enseignant=True)
+ if fonction == "expert":
+ list = list.exclude(expertise=None)
+
+
return list
def index(request):
pub = publication4_form.save()
c.publication4 = pub
these = these_form.save()
- expertise = expertise_form.save()
+ if expertise_form.is_valid() and expertise_form.cleaned_data['nom']:
+ expertise = expertise_form.save()
c.these = these
c.expertise = expertise
etablissement_form.save(commit=False)
if publication4_form.is_valid() and publication4_form.cleaned_data['titre']:
chercheur.publication4 = publication4_form.save()
chercheur.these = these_form.save()
- chercheur.expertise = expertise_form.save()
+ if expertise_form.cleaned_data['nom']:
+ chercheur.expertise = expertise_form.save()
chercheur.save()
#Gestion des groupes
groupes = request.POST.getlist('groupe-groupes')