adicionando mais informações no skel
[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         AreaDeInteresse, CategoriaPalestra, STATE_CHOICES
24
25 MKCHOICES = lambda K:[(x.id, str(x)) for x in K.objects.all()]
26
27 class InscreverPalestra(forms.Form):
28     def __init__(self, *args, **kwargs):
29         super(InscreverPalestra, self).__init__(*args, **kwargs)
30
31         newchoices = MKCHOICES(CategoriaPalestra)
32         self.fields['categoria'].choices = newchoices
33
34     titulo = forms.CharField(max_length=100)
35     tema = forms.CharField(max_length=100)
36     categoria = forms.ChoiceField()
37     descricao_curta = forms.CharField(widget=Textarea(),
38         label='Descrição curta')
39     descricao_longa = forms.CharField(widget=Textarea(),
40         label='Descrição longa')
41
42
43 class CadastroPalestrante(forms.Form):
44     def __init__(self, *args, **kwargs):
45         super(CadastroPalestrante, self).__init__(*args, **kwargs)
46
47         newchoices = MKCHOICES(AreaDeInteresse)
48         self.fields['area_interesse'].choices = newchoices
49
50     nome_completo = forms.CharField(max_length=100)
51     nome_usuario = forms.CharField(max_length=100)
52     senha = forms.CharField(max_length=100, widget=PasswordInput())
53     email = forms.CharField(max_length=100)
54
55     telefone_comercial = forms.CharField(max_length=11, required=False)
56     telefone_residencial = forms.CharField(max_length=11, required=False)
57     telefone_celular = forms.CharField(max_length=11, required=False)
58
59     instituicao = forms.CharField(max_length=100, label='Instituição')
60     minicurriculo = forms.CharField(widget=Textarea(), label='Mini Currículo')
61
62     rua = forms.CharField(max_length=100)
63     numero = forms.CharField(max_length=10, label='Número')
64     bairro = forms.CharField(max_length=100)
65     cidade = forms.CharField(max_length=100)
66     uf = forms.ChoiceField(choices=STATE_CHOICES)
67
68     area_interesse = forms.MultipleChoiceField(label='Áreas de Interesse')
69
70
71 class Inscricao(forms.Form):
72     nome_completo = forms.CharField(max_length=100)
73     cpf = forms.CharField(max_length=100)
74     email = forms.CharField(max_length=100)
75
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)