arrumando um bug de portugues (valews metal =)
[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, xid=-1:[(x.id, str(x)) for x in K.objects.all() \
26         if xid != x.id]
27
28 class SubmeterTrabalho(forms.Form):
29     def __init__(self, request, *args, **kwargs):
30         super(SubmeterTrabalho, self).__init__(*args, **kwargs)
31
32         newchoices = MKCHOICES(TipoTrabalho)
33         self.fields['tipo'].choices = newchoices
34
35         palestrante = request.user.palestrante_set.get()
36         newchoices = MKCHOICES(Palestrante, xid=palestrante.id)
37         self.fields['outros_palestrantes'].choices = newchoices
38
39     titulo = forms.CharField(max_length=100, label='Título do trabalho')
40     tipo = forms.ChoiceField()
41     descricao_curta = forms.CharField(widget=Textarea(),
42         label='Descrição curta', max_length=250,
43         help_text='Esta descrição será utilizada para exibição no '
44                   'material de divulgação (máximo 250 caracteres).')
45     descricao_longa = forms.CharField(widget=Textarea(),
46         max_length=1500, label='Descrição longa',
47         help_text='Esta descrição será utilizada para avaliação do seu '
48                   'trabalho. Insira também referências '
49                   '(máximo 1500 caracteres).')
50     recursos = forms.CharField(widget=Textarea(), max_length=300, required=0,
51         help_text='Liste os recursos que seu trabalho irá necessitar, '
52                   'ex.: Computadores, softwares, etc. Máximo de 300 caracteres.')
53     outros_palestrantes = forms.MultipleChoiceField(required=0)
54
55 class CadastroPalestrante(forms.Form):
56     nome_completo = forms.CharField(max_length=100)
57     nome_usuario = forms.CharField(max_length=100)
58     senha = forms.CharField(max_length=100, widget=PasswordInput())
59     senha_2 = forms.CharField(max_length=100, widget=PasswordInput(),
60         label='Conferir Senha')
61     email = forms.CharField(max_length=100)
62
63     telefone = forms.CharField(required=False)
64     celular = forms.CharField(required=False)
65
66     instituicao = forms.CharField(max_length=100, label='Instituição')
67     minicurriculo = forms.CharField(widget=Textarea(), max_length=250, label='Mini Currículo',
68        help_text='Este mini currículo será utilizado no material de divulgação '
69                  'e no sítio. Máximo de 250 caracteres.')
70     curriculo = forms.CharField(widget=Textarea(), max_length=6000, label='Currículo',
71        help_text='Este currículo será utilizado para avaliação do palestrante. '
72                  'Máximo de 6000 caracteres.')
73     rua = forms.CharField(max_length=100)
74     numero = forms.CharField(max_length=10, label='Número')
75     bairro = forms.CharField(max_length=100)
76     cidade = forms.CharField(max_length=100)
77     uf = forms.ChoiceField(choices=STATE_CHOICES)
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=6000, label='Currículo',
91        help_text='Este currículo será utilizado para avaliação do palestrante.'
92                  'Máximo de 6000 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 class EditarSenha(forms.Form):
100     senha_atual = forms.CharField(max_length=100, widget=PasswordInput())
101     nova_senha = forms.CharField(max_length=100, widget=PasswordInput())
102     nova_senha_2 = forms.CharField(max_length=100, widget=PasswordInput(),
103         label='Conferir Senha')
104
105 class InscricaoCaravana(forms.Form):
106     lista_nomes = forms.CharField(label='Lista de nomes',
107         widget=forms.Textarea(), help_text='Um participante por linha, '
108         'informando nome completo e email no seguine formato: '
109         'Nome Completo &lt;email@server.domain&gt;')
110
111 class InscricaoBase(forms.Form):
112     nome_completo = forms.CharField(max_length=100)
113     rg = forms.CharField(max_length=100)
114     nome_usuario = forms.CharField(max_length=100)
115     senha = forms.CharField(max_length=100, widget=PasswordInput())
116     senha_2 = forms.CharField(max_length=100, widget=PasswordInput(),
117         label='Conferir Senha')
118
119     email = forms.CharField(max_length=100)
120     rua = forms.CharField(max_length=100)
121     numero = forms.CharField(max_length=10, label='Número')
122     bairro = forms.CharField(max_length=100)
123     cidade = forms.CharField(max_length=100)
124     uf = forms.ChoiceField(choices=STATE_CHOICES)
125     telefone = forms.CharField(max_length=100)
126     home_page = forms.CharField(max_length=100, label='Página Pessoal',
127         required=False)
128
129 class Inscricao(InscricaoBase):
130     inscricao_comercial = forms.BooleanField(required=False,
131         label='Inscrição Comercial')
132
133 class InscricaoCoordenador(InscricaoBase):
134     pass