Merge branch 'master' of ssh://hammerboy/home/lincoln/pessoal/eventmanager
[cascardo/eventmanager.git] / forms.py
1 # -*- coding: utf-8; -*-
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(TipoTrabalho)
32         self.fields['tipo'].choices = newchoices
33
34         newchoices = MKCHOICES(Palestrante)
35         self.fields['outros_palestrantes'].choices = newchoices
36
37     titulo = forms.CharField(max_length=100, label='Título do trabalho')
38     tipo = forms.ChoiceField()
39     descricao_curta = forms.CharField(widget=Textarea(),
40         label='Descrição curta', max_length=250,
41         help_text='Esta descrição será utilizada para exibição no '
42                   'material de divulgação (máximo 250 caracteres).')
43     descricao_longa = forms.CharField(widget=Textarea(),
44         max_length=1500, label='Descrição longa',
45         help_text='Esta descrição será utilizada para avaliação do seu '
46                   'trabalho. Insira também referências '
47                   '(máximo 1500 caracteres).')
48     recursos = forms.CharField(widget=Textarea(), max_length=300, required=0,
49         help_text='Liste os recursos que seu trabalho irá necessitar, '
50                   'ex.: Computadores, softwares, etc. Máximo de 300 caracteres.')
51     outros_palestrantes = forms.MultipleChoiceField(required=0)
52
53
54 class CadastroPalestrante(forms.Form):
55     nome_completo = forms.CharField(max_length=100)
56     nome_usuario = forms.CharField(max_length=100)
57     senha = forms.CharField(max_length=100, widget=PasswordInput())
58     senha_2 = forms.CharField(max_length=100, widget=PasswordInput(),
59         label='Conferir Senha')
60     email = forms.CharField(max_length=100)
61
62     telefone = forms.CharField(required=False)
63     celular = forms.CharField(required=False)
64
65     instituicao = forms.CharField(max_length=100, label='Instituição')
66     minicurriculo = forms.CharField(widget=Textarea(), max_length=250, label='Mini Currículo',
67        help_text='Este mini currículo será utilizado no material de divulgação'
68                  'e no site. Máximo de 250 caracteres.')
69     curriculo = forms.CharField(widget=Textarea(), max_length=1000, label='Currículo',
70        help_text='Este currículo será utilizado para avaliação do palestrante.'
71                  'Máximo de 1000 caracteres.')
72     rua = forms.CharField(max_length=100)
73     numero = forms.CharField(max_length=10, label='Número')
74     bairro = forms.CharField(max_length=100)
75     cidade = forms.CharField(max_length=100)
76     uf = forms.ChoiceField(choices=STATE_CHOICES)
77
78
79 class EditarPalestrante(forms.Form):
80     nome = forms.CharField(max_length=100, label='Nome completo')
81     email = forms.CharField(max_length=100)
82
83     telefone = forms.CharField(required=False)
84     celular = forms.CharField(required=False)
85
86     instituicao = forms.CharField(max_length=100, label='Instituição')
87     minicurriculo = forms.CharField(widget=Textarea(), max_length=250, label='Mini Currículo',
88        help_text='Este mini currículo será utilizado no material de divulgação'
89                  'e no site. Máximo de 250 caracteres.')
90     curriculo = forms.CharField(widget=Textarea(), max_length=1000, label='Currículo',
91        help_text='Este currículo será utilizado para avaliação do palestrante.'
92                  'Máximo de 1000 caracteres.')
93     rua = forms.CharField(max_length=100)
94     numero = forms.CharField(max_length=10, label='Número')
95     bairro = forms.CharField(max_length=100)
96     cidade = forms.CharField(max_length=100)
97     uf = forms.ChoiceField(choices=STATE_CHOICES)
98
99
100 class EditarSenha(forms.Form):
101     senha_atual = forms.CharField(max_length=100, widget=PasswordInput())
102     nova_senha = forms.CharField(max_length=100, widget=PasswordInput())
103     nova_senha_2 = forms.CharField(max_length=100, widget=PasswordInput(),
104         label='Conferir Senha')
105
106
107 class Inscricao(forms.Form):
108     nome_completo = forms.CharField(max_length=100)
109     cpf = forms.CharField(max_length=100)
110     email = forms.CharField(max_length=100)
111
112     rua = forms.CharField(max_length=100)
113     numero = forms.CharField(max_length=10, label='Número')
114     bairro = forms.CharField(max_length=100)
115     cidade = forms.CharField(max_length=100)
116     uf = forms.ChoiceField(choices=STATE_CHOICES)
117