# 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
# 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='/')