CRUD evenement + admin
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / savoirs / forms.py
1 # -*- encoding: utf-8 -*-
2 from django import forms
3 from datamaster_modeles.models import Thematique, Pays, Region
4 from models import Evenement, Discipline
5
6 class RechercheAvancee (forms.Form):
7 creator = forms.CharField (max_length=60, required=False, \
8 label = "Auteur ou contributeur") # + contributor
9 title = forms.CharField (max_length=100, required=False, \
10 label = "Titre") # + alt_title
11 description = forms.CharField (max_length=100, required=False, \
12 label = "Description ou résumé") # + abstract
13 subject = forms.CharField (max_length=100, required=False, label = "Sujet")
14 operator = forms.ChoiceField (choices = (('or', 'ou'), ('and', 'et')), label = "Operateur")
15 type = forms.CharField (initial='avancee', required=False, widget=forms.HiddenInput)
16
17
18 class EvenementForm(forms.ModelForm):
19 class Meta:
20 model = Evenement
21 exclude = ('approuve', 'uid')
22
23 # Admin views pour les associations par lots
24
25 class PaysForm(forms.Form):
26 values = [(p.id, p.nom) for p in Pays.objects.all()]
27 pays = forms.MultipleChoiceField(choices=values)
28
29 class RegionsForm(forms.Form):
30 values = [(r.id, r.nom) for r in Region.objects.all()]
31 regions = forms.MultipleChoiceField(choices=values)
32
33 class ThematiquesForm(forms.Form):
34 values = [(t.id, t.nom) for t in Thematique.objects.all()]
35 thematiques = forms.MultipleChoiceField(choices=values)
36
37 class DisciplinesForm(forms.Form):
38 values = [(t.id, t.nom) for t in Discipline.objects.all()]
39 disciplines = forms.MultipleChoiceField(choices=values)
40
41 class ConfirmationForm(forms.Form):
42 pass
43