Merge git://hammerboy.no-ip.org/eventmanager
authorwww-data <www-data@mail.holoscopio.com>
Wed, 26 Sep 2007 05:15:32 +0000 (02:15 -0300)
committerwww-data <www-data@mail.holoscopio.com>
Wed, 26 Sep 2007 05:15:32 +0000 (02:15 -0300)
Conflicts:

forms.py
settings.py
templates/editar_trabalho.html
templates/inscricao.html
templates/meus_trabalhos.html
views.py

settings.py
templates/editar_trabalho.html
views.py

index faa5b26..baff74b 100644 (file)
@@ -24,7 +24,7 @@ DATABASE_PORT = ''             # Set to empty string for default. Not used with
 # although not all variations may be possible on all operating systems.
 # If running in a Windows environment this must be set to the same as your
 # system time zone.
-TIME_ZONE = 'America/Sao_paulo'
+TIME_ZONE = 'America/Sao_Paulo'
 
 # Language code for this installation. All choices can be found here:
 # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
index 3febcc8..38a4595 100644 (file)
@@ -4,8 +4,8 @@
 <h2>Editar trabalho</h2>
 
 {% if formulario %}
-<form method="post" action="" id="cadastro">
-<table>  {{ formulario.as_p }}</table>
+<form method="post" action="">
+<table>  {{ formulario.as_table }}</table>
 <input type="submit" value="Modificar trabalho"/>
 </form>
 
index 010afaf..36ddaca 100644 (file)
--- a/views.py
+++ b/views.py
@@ -315,11 +315,34 @@ def meus_trabalhos(request):
         # não palestrante...
         c = {'palestrante': 0}
         return build_response(request, 'meus_trabalhos.html', c)
-
     t = Trabalho.objects.filter(palestrante=p)
     c = {'trabalhos': t, 'palestrante': 1}
     return build_response(request, 'meus_trabalhos.html', c)
 
+@login_required
+@user_passes_test(lambda u:u.palestrante_set.count() == 1, login_url='/')
+def editar_trabalho(request,codigo):
+    try:
+        p = Palestrante.objects.get(usuario=request.user)
+    except Palestrante.DoesNotExist:
+        # não palestrante...
+        c = {'palestrante': 0}
+        return build_response(request, 'meus_trabalhos.html', c)
+    trabalho = get_object_or_404(Trabalho, id=codigo,palestrante=p)
+    Formulario = form_for_instance(trabalho)
+    if request.method == 'POST':
+        form = Formulario(request.POST)
+        if form.is_valid():
+            form.save()
+            t = Trabalho.objects.filter(palestrante=p)
+            c = {'trabalhos': t, 'palestrante': 1}
+            c['editado_sucesso']=trabalho.titulo
+            return build_response(request, 'meus_trabalhos.html', c)
+    else:
+        form = Formulario()
+    
+    c = {'formulario':form}
+    return build_response(request, 'editar_trabalho.html', c)
 
 @login_required
 @user_passes_test(lambda u:u.palestrante_set.count() == 1, login_url='/')