Acrescentados hints dos formulários de cadastro de palestrantes e edição de palestrantes.
[cascardo/eventmanager.git] / forms.py
1 # -*- coding: utf8; -*-
2 """
3 Copyright (C) 2007 Lincoln de Sousa <lincoln@archlinux-br.org>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with this program; if not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 """
20 from django import newforms as forms
21 from django.newforms.widgets import Textarea, PasswordInput
22 from eventmanager.eventos.models import \
23         TipoTrabalho, CategoriaTrabalho, Palestrante, STATE_CHOICES
24
25 MKCHOICES = lambda K:[(x.id, str(x)) for x in K.objects.all()]
26
27 class SubmeterTrabalho(forms.Form):
28     def __init__(self, *args, **kwargs):
29         super(SubmeterTrabalho, self).__init__(*args, **kwargs)
30
31         newchoices = MKCHOICES(CategoriaTrabalho)
32         self.fields['categoria'].choices = newchoices
33
34         newchoices = MKCHOICES(TipoTrabalho)
35         self.fields['tipo'].choices = newchoices
36
37         newchoices = MKCHOICES(Palestrante)
38         self.fields['outros_palestrantes'].choices = newchoices
39
40     titulo = forms.CharField(max_length=100, label='Título do trabalho')
41     tipo = forms.ChoiceField()
42     categoria = forms.ChoiceField()
43     descricao_curta = forms.CharField(widget=Textarea(),
44         label='Descrição curta', max_length=250,
45         help_text='Esta descrição será utilizada para exibição no '
46                   'material de divulgação (máximo 250 caracteres).')
47     descricao_longa = forms.CharField(widget=Textarea(),
48         max_length=1500, label='Descrição longa',
49         help_text='Esta descrição será utilizada para avaliação do seu '
50                   'trabalho. Insira também referências '
51                   '(máximo 1500 caracteres).')
52     recursos = forms.CharField(widget=Textarea(), max_length=300, required=0,
53         help_text='Liste os recursos que seu trabalho irá necessitar, '
54                   'ex.: Computadores, softwares, etc. Máximo de 300 caracteres.')
55     outros_palestrantes = forms.MultipleChoiceField(required=0)
56
57
58 class CadastroPalestrante(forms.Form):
59     nome_completo = forms.CharField(max_length=100)
60     nome_usuario = forms.CharField(max_length=100)
61     senha = forms.CharField(max_length=100, widget=PasswordInput())
62     senha_2 = forms.CharField(max_length=100, widget=PasswordInput(),
63         label='Conferir Senha')
64     email = forms.CharField(max_length=100)
65
66     telefone = forms.CharField(required=False)
67     celular = forms.CharField(required=False)
68
69     instituicao = forms.CharField(max_length=100, label='Instituição')
70     minicurriculo = forms.CharField(widget=Textarea(), max_length=250, label='Mini Currículo',
71        help_text='Este mini currículo será utilizado no material de divulgação'
72                  'e no site. Máximo de 250 caracteres.')
73     curriculo = forms.CharField(widget=Textarea(), max_length=1000, label='Currículo',
74        help_text='Este currículo será utilizado para avaliação do palestrante.'
75                  'Máximo de 1000 caracteres.')
76     rua = forms.CharField(max_length=100)
77     numero = forms.CharField(max_length=10, label='Número')
78     bairro = forms.CharField(max_length=100)
79     cidade = forms.CharField(max_length=100)
80     uf = forms.ChoiceField(choices=STATE_CHOICES)
81
82
83 class EditarPalestrante(forms.Form):
84     nome = forms.CharField(max_length=100, label='Nome completo')
85     email = forms.CharField(max_length=100)
86
87     telefone = forms.CharField(required=False)
88     celular = forms.CharField(required=False)
89
90     instituicao = forms.CharField(max_length=100, label='Instituição')
91     minicurriculo = forms.CharField(widget=Textarea(), max_length=250, label='Mini Currículo',
92        help_text='Este mini currículo será utilizado no material de divulgação'
93                  'e no site. Máximo de 250 caracteres.')
94     curriculo = forms.CharField(widget=Textarea(), max_length=1000, label='Currículo',
95        help_text='Este currículo será utilizado para avaliação do palestrante.'
96                  'Máximo de 1000 caracteres.')
97     rua = forms.CharField(max_length=100)
98     numero = forms.CharField(max_length=10, label='Número')
99     bairro = forms.CharField(max_length=100)
100     cidade = forms.CharField(max_length=100)
101     uf = forms.ChoiceField(choices=STATE_CHOICES)
102
103
104 class EditarSenha(forms.Form):
105     senha_atual = forms.CharField(max_length=100, widget=PasswordInput())
106     nova_senha = forms.CharField(max_length=100, widget=PasswordInput())
107     nova_senha_2 = forms.CharField(max_length=100, widget=PasswordInput(),
108         label='Conferir Senha')
109
110
111 class Inscricao(forms.Form):
112     nome_completo = forms.CharField(max_length=100)
113     cpf = forms.CharField(max_length=100)
114     email = forms.CharField(max_length=100)
115
116     rua = forms.CharField(max_length=100)
117     numero = forms.CharField(max_length=10, label='Número')
118     bairro = forms.CharField(max_length=100)
119     cidade = forms.CharField(max_length=100)
120     uf = forms.ChoiceField(choices=STATE_CHOICES)
121