class Admin:
fields = (
- (None, {'fields': ('nome', 'data_inicio', 'data_final')}),
+ ('Informações do evento', {'fields': ('nome', 'data_inicio', 'data_final')}),
('Informações da sede', {'fields': ('nome_local', 'nome_contato',
- 'cidade', 'uf', 'rua', 'numero', 'info_adicional')}),
+ 'cidade', 'uf', 'rua', 'numero','telefone', 'info_adicional')}),
)
def __str__(self):
'ex.: Computadores, softwares, etc. Máximo de 300 caracteres.')
outros_palestrantes = forms.MultipleChoiceField(required=0)
-
class CadastroPalestrante(forms.Form):
nome_completo = forms.CharField(max_length=100)
nome_usuario = forms.CharField(max_length=100)
# 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/Chicago'
+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
--- /dev/null
+{% extends "base.html" %}
+{% block content %}
+
+<h2>Editar trabalho</h2>
+
+{% if formulario %}
+<form method="post" action="">
+<table> {{ formulario.as_table }}</table>
+<input type="submit" value="Modificar trabalho"/>
+</form>
+
+
+
+{% else %}
+ <h3>O trabalho selecionado não existe, verifique o link</h3>
+{% endif %}
+
+{% endblock %}
<h2>Trabalhos Inscritos</h2>
+{# o if abaixo eh para o caso de algum trabalho ter sido editado e redirecionado #}
+{% if editado_sucesso %}
+ <br />
+ <h4>O trabalho "{{ editado_sucesso}}" for editado com sucesso!</h4>
+ <br />
+{% endif %}
+
{% if trabalhos %}
<ul>
(r'^submeter_trabalho/', views.submeter_trabalho),
(r'^cadastro_palestrante/', views.cadastro_palestrante),
(r'^meus_trabalhos/', views.meus_trabalhos),
+ (r'^trabalhos/(?P<codigo>\d+)', views.editar_trabalho),
(r'^meus_dados/', views.meus_dados),
(r'^chamada_trabalhos/', views.chamada_trabalhos),
(r'^avaliacao/', views.avaliacao),
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
"""
-from django.shortcuts import render_to_response
+from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext, Context
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth.models import Group, User
from eventmanager.forms import *
from eventmanager.conteudo.models import Noticia, Menu, Secao
from eventmanager.eventos.models import *
+from django.newforms import form_for_instance
def build_response(request, template, extra={}):
"""
# 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
def meus_dados(request):