notificacao do usuário quando o login estiver incorreto e melhorando umas mensagens...
[cascardo/eventmanager.git] / forms.py
index 1d2c3c2..cac8fd6 100644 (file)
--- a/forms.py
+++ b/forms.py
@@ -1,4 +1,4 @@
-# -*- coding: utf8; -*-
+# -*- coding: utf-8; -*-
 """
 Copyright (C) 2007 Lincoln de Sousa <lincoln@archlinux-br.org>
 
@@ -22,24 +22,22 @@ from django.newforms.widgets import Textarea, PasswordInput
 from eventmanager.eventos.models import \
         TipoTrabalho, CategoriaTrabalho, Palestrante, STATE_CHOICES
 
-MKCHOICES = lambda K:[(x.id, str(x)) for x in K.objects.all()]
+MKCHOICES = lambda K, xid=-1:[(x.id, str(x)) for x in K.objects.all() \
+        if xid != x.id]
 
 class SubmeterTrabalho(forms.Form):
-    def __init__(self, *args, **kwargs):
+    def __init__(self, request, *args, **kwargs):
         super(SubmeterTrabalho, self).__init__(*args, **kwargs)
 
-        newchoices = MKCHOICES(CategoriaTrabalho)
-        self.fields['categoria'].choices = newchoices
-
         newchoices = MKCHOICES(TipoTrabalho)
         self.fields['tipo'].choices = newchoices
 
-        newchoices = MKCHOICES(Palestrante)
+        palestrante = request.user.palestrante_set.get()
+        newchoices = MKCHOICES(Palestrante, xid=palestrante.id)
         self.fields['outros_palestrantes'].choices = newchoices
 
     titulo = forms.CharField(max_length=100, label='Título do trabalho')
     tipo = forms.ChoiceField()
-    categoria = forms.ChoiceField()
     descricao_curta = forms.CharField(widget=Textarea(),
         label='Descrição curta', max_length=250,
         help_text='Esta descrição será utilizada para exibição no '
@@ -68,11 +66,11 @@ class CadastroPalestrante(forms.Form):
 
     instituicao = forms.CharField(max_length=100, label='Instituição')
     minicurriculo = forms.CharField(widget=Textarea(), max_length=250, label='Mini Currículo',
-       help_text='Este mini currículo será utilizado no material de divulgação'
-                 'e no site. Máximo de 250 caracteres.')
-    curriculo = forms.CharField(widget=Textarea(), max_length=1000, label='Currículo',
-       help_text='Este currículo será utilizado para avaliação do palestrante.'
-                 'Máximo de 1000 caracteres.')
+       help_text='Este mini currículo será utilizado no material de divulgação '
+                 'e no sítio. Máximo de 250 caracteres.')
+    curriculo = forms.CharField(widget=Textarea(), max_length=6000, label='Currículo',
+       help_text='Este currículo será utilizado para avaliação do palestrante. '
+                 'Máximo de 6000 caracteres.')
     rua = forms.CharField(max_length=100)
     numero = forms.CharField(max_length=10, label='Número')
     bairro = forms.CharField(max_length=100)
@@ -91,9 +89,9 @@ class EditarPalestrante(forms.Form):
     minicurriculo = forms.CharField(widget=Textarea(), max_length=250, label='Mini Currículo',
        help_text='Este mini currículo será utilizado no material de divulgação'
                  'e no site. Máximo de 250 caracteres.')
-    curriculo = forms.CharField(widget=Textarea(), max_length=1000, label='Currículo',
+    curriculo = forms.CharField(widget=Textarea(), max_length=6000, label='Currículo',
        help_text='Este currículo será utilizado para avaliação do palestrante.'
-                 'Máximo de 1000 caracteres.')
+                 'Máximo de 6000 caracteres.')
     rua = forms.CharField(max_length=100)
     numero = forms.CharField(max_length=10, label='Número')
     bairro = forms.CharField(max_length=100)
@@ -118,4 +116,28 @@ class Inscricao(forms.Form):
     bairro = forms.CharField(max_length=100)
     cidade = forms.CharField(max_length=100)
     uf = forms.ChoiceField(choices=STATE_CHOICES)
+    pagina_pessoal = forms.CharField(max_length=100)
+
+    telefone = forms.CharField(max_length=100)
+    estudante = forms.BooleanField(required=False)
+
+    first_step = forms.CharField(max_length=1,
+            widget=forms.HiddenInput, initial='1')
+
+
+class InscricaoEstudante(forms.Form):
+    post2 = forms.CharField(max_length=1,
+            widget=forms.HiddenInput, initial='1')
+    estudante = forms.CharField(max_length=1,
+            widget=forms.HiddenInput, initial='1')
+
+    instituicao = forms.CharField(max_length=100)
+    curso = forms.CharField(max_length=100)
+    periodo = forms.CharField(max_length=100)
+
+
+class InscricaoNormal(forms.Form):
+    empresa = forms.CharField(max_length=100)
+    post2 = forms.CharField(max_length=1,
+            widget=forms.HiddenInput, initial='1')