fazendo o formulário de inscrição individual funcionar (sem boleto ainda)
authorLincoln de Sousa <lincoln@archlinux-br.org>
Mon, 24 Sep 2007 23:11:11 +0000 (20:11 -0300)
committerLincoln de Sousa <lincoln@archlinux-br.org>
Mon, 24 Sep 2007 23:11:11 +0000 (20:11 -0300)
eventos/models.py
forms.py
templates/inscricao_individual.html
views.py

index 9b2b233..6bc01f6 100644 (file)
@@ -87,11 +87,9 @@ class Participante(models.Model):
     nome = models.CharField(maxlength=100)
     email = models.CharField(maxlength=100)
     rg = models.CharField(maxlength=100)
-    home_page = models.CharField(maxlength=100)
+    home_page = models.CharField(maxlength=100, blank=True)
 
     telefone = models.CharField(maxlength=100, blank=True)
-    celular = models.CharField(maxlength=100, blank=True)
-
     rua = models.CharField(maxlength=100)
     numero = models.CharField(maxlength=10)
     bairro = models.CharField(maxlength=100)
index 46a1ebb..9a60daf 100644 (file)
--- a/forms.py
+++ b/forms.py
@@ -122,10 +122,9 @@ class InscricaoBase(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)
-
+    home_page = forms.CharField(max_length=100, label='Página Pessoal',
+        required=False)
 
 class Inscricao(InscricaoBase):
     inscricao_comercial = forms.BooleanField(required=False,
index 7f92d20..469bf5a 100644 (file)
@@ -6,7 +6,7 @@
 {% if ok %}
 
 <div class="confirmation">
-    <p>Cadastro efetuado com sucesso, você já foi autenticado.</p>
+    <p>Cadastro efetuado com sucesso.</p>
 </div>
 
 {% else %}
index ee7b1b3..1c1024b 100644 (file)
--- a/views.py
+++ b/views.py
@@ -170,7 +170,7 @@ def inscricao_individual(request):
         except User.DoesNotExist:
             pass
 
-        if cd['senha'] != cd['senha_2']:
+        if not wrong and cd['senha'] != cd['senha_2']:
             badattr['senha_2'] = ['A senha não confere']
             wrong = True
             transaction.rollback()
@@ -184,9 +184,24 @@ def inscricao_individual(request):
             user.save()
             user.groups.add(group)
 
-        transaction.commit()
+            p = Participante()
+            import pdb; pdb.set_trace()
+            p.nome = cd['nome_completo']
+            p.rg = cd['rg']
+            p.email = cd['email']
+            p.rua = cd['rua']
+            p.numero = cd['numero']
+            p.bairro = cd['bairro']
+            p.cidade = cd['cidade']
+            p.uf = cd['uf']
+            p.telefone = cd['telefone']
+            p.home_page = cd['home_page']
+            p.save()
 
-    return build_response(request, 'inscricao_individual.html', {'form': form})
+            ok = True
+            transaction.commit()
+    c = {'form': form, 'ok': ok}
+    return build_response(request, 'inscricao_individual.html', c)
 
 
 @enable_login_form