adicionando as views e fazendo o login funcionar
authorLincoln de Sousa <pythonwarrior@pidinti.localdomain>
Tue, 24 Jul 2007 04:18:48 +0000 (01:18 -0300)
committerLincoln de Sousa <pythonwarrior@pidinti.localdomain>
Tue, 24 Jul 2007 04:18:48 +0000 (01:18 -0300)
eventos/models.py
forms.py
templates/base.html
templates/index.html
urls.py
views.py

index cc9c965..4d96f24 100644 (file)
@@ -29,7 +29,7 @@ class Evento(models.Model):
     nome_contato = models.CharField('Nome do contato', maxlength=100)
     telefone = models.CharField(maxlength=100)
     cidade = models.CharField(maxlength=100)
-    estado = models.CharField(maxlength=100) # TODO: can became a combobox
+    uf = models.CharField(maxlength=100) # TODO: should became a combobox
     rua = models.CharField(maxlength=100)
     numero = models.CharField('Número', maxlength=10)
     info_adicional = models.TextField()
@@ -38,7 +38,7 @@ class Evento(models.Model):
         fields = (
             (None, {'fields': ('nome', 'data_inicio', 'data_final')}),
             ('Informações da sede', {'fields': ('nome_local', 'nome_contato',
-                'cidade', 'estado', 'rua', 'numero', 'info_adicional')}),
+                'cidade', 'uf', 'rua', 'numero', 'info_adicional')}),
         )
 
     def __str__(self):
@@ -86,6 +86,16 @@ class Palestrante(models.Model):
         return self.nome
 
 
+class Participante(models.Model):
+    nome = models.CharField(maxlength=100)
+
+    class Admin:
+        pass
+
+    def __str__(self):
+        return self.nome
+
+
 class CategoriaPalestra(models.Model):
     nome = models.CharField(maxlength=100)
 
index 125f594..7a95937 100644 (file)
--- a/forms.py
+++ b/forms.py
@@ -17,6 +17,26 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.
 """
 from django import newforms as forms
+from django.newforms.widgets import Textarea
 
 class InscreverPalestra(forms.Form):
     pass
+
+class CadastroPalestrante(forms.Form):
+    nome = forms.CharField(max_length=100)
+    email = forms.CharField(max_length=100)
+
+    telefone_comercial = forms.CharField(max_length=11)
+    telefone_residencial = forms.CharField(max_length=11)
+    telefone_celular = forms.CharField(max_length=11)
+
+    instituicao = forms.CharField(max_length=100)
+    minicurriculo = forms.CharField(widget=Textarea())
+
+    rua = forms.CharField(max_length=100)
+    numero = forms.CharField(max_length=10)
+    bairro = forms.CharField(max_length=100)
+    cidade = forms.CharField(max_length=100)
+    uf = forms.CharField(max_length=100)
+
+    areas_interesse = forms.MultipleChoiceField()
index 43545be..06c6263 100644 (file)
@@ -5,9 +5,46 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt_BR" lang="pt_BR">
     <head>
         <title>Encontro Mineiro de Software Livre</title>
+
+        <style type="text/css">
+            body {
+                margin: 10px;
+                background-color: #fff;
+            }
+
+            h1.title {
+                color: #f00;
+            }
+
+            label {
+                display: block;
+                width: 180px;
+                font-weight: bold;
+            }
+
+            #login-form {
+                position: absolute;
+                right: 10px;
+                background-color: #f7f7f7;
+                padding: 10px;
+            }
+
+            #login-form label {
+                width: 80px !important;
+                float: left;
+            }
+
+            #login-form input[type=text] {
+                width: 100px;
+            }
+
+            #login-form input[type=password]  {
+                width: 40px;
+            }
+        </style>
     </head>
     <body>
-        <h1>Encontro Mineiro de Software Livre</h1>
+        <h1 class="title">Encontro Mineiro de Software Livre</h1>
 
         {% if user.is_authenticated %}
 
         <form id="login-form" method="post" action=".">
             <h3>Login</h3>
             <div class="field">
-                <label for="id_username">{% trans "Username" %}</label>
+                <label for="id_username">Usuário:</label>
                 <input id="id_username" class="vTextField required" type="text"
-                       maxlength="30" name="username" style="width: 85px" />
+                       maxlength="30" name="username" />
             </div>
             <div class="field">
-                <label for="id_password-login">{% trans "Password" %}</label>
+                <label for="id_password-login">Senha:</label>
                 <input id="id_password-login" class="vTextField required"
-                       type="password" name="password" style="width: 45px;" />
+                       type="password" name="password" />
 
                 <input type="submit" value="Login" class="submit" name="submitting_login_form" />
             </div>
+
+            <a href="/cadastro">Cadastre-se</a>
         </form>
 
         {% endif %}
 
-        {% block content %}
-        {% endblock %}
+        <div id="conteudo">
+        {% block content %}{% endblock %}
+        </div>
 
     </body>
 </html>
+{# vim: set ft=htmldjango: #}
index beced90..f43889d 100644 (file)
@@ -1,6 +1,6 @@
 {% extends "base.html" %}
 {% block content %}
 
-teste
+Openarena R0X
 
 {% endblock %}
diff --git a/urls.py b/urls.py
index c516b31..ddf7ec9 100644 (file)
--- a/urls.py
+++ b/urls.py
@@ -24,5 +24,6 @@ urlpatterns = patterns('',
     (r'^logout/', 'django.contrib.auth.views.logout',
         {'next_page': '/'}),
     (r'^inscrever_palestra/', views.inscrever_palestra),
+    (r'^cadastro/', views.cadastro),
     (r'^$', views.index),
 )
index 13d35d8..243bf30 100644 (file)
--- a/views.py
+++ b/views.py
@@ -17,16 +17,24 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.
 """
 from django.shortcuts import render_to_response
-from django.template import RequestContext
+from django.template import RequestContext, Context
 from eventmanager.decorators import enable_login_form
+from eventmanager.forms import InscreverPalestra, CadastroPalestrante
 
 @enable_login_form
 def index(request):
     return render_to_response('index.html',
             context_instance=RequestContext(request))
 
+@enable_login_form
+def cadastro(request):
+    form = CadastroPalestrante()
+    c = Context({'form': form})
+    return render_to_response('cadastro.html', c,
+            context_instance=RequestContext(request))
 
 def inscrever_palestra(request):
-    form = forms.InscreverPalestra()
-    return render_to_response('inscrever_palestra.html',
+    form = InscreverPalestra()
+    c = Context({'form': form})
+    return render_to_response('inscrever_palestra.html', c,
             context_instance=RequestContext(request))