+ return HttpResponseRedirect('/')
+
+def lecturer_details(request, lid):
+ """Shows a simple form containing all editable fields of a
+ lecturer and gives the lecturer the possibility to save them =)
+ """
+ entity = request.user.palestrante_set.get()
+ # avoiding problems if some other user tries to edit the lecturer
+ # info.
+ if entity.id != int(lid):
+ return HttpResponseForbidden('<h2>You are not '
+ 'allowed to edit '
+ 'this info.<h2>')
+
+ FormKlass = form_for_instance(entity)
+ del FormKlass.base_fields['usuario']
+
+ form = FormKlass(request.POST or None)
+ if request.POST and form.is_valid():
+ form.save()
+
+ c = {'form': form}
+ return render_to_response('eventos/lecturer-details.html', Context(c),
+ context_instance=RequestContext(request))
+
+def lecturer_talks(request, lid):
+ """Lists all talks of a lecturer (based on lecturer id -- lid
+ parameter).
+ """
+ lecturer = get_object_or_404(Palestrante, pk=lid)
+ talks = Trabalho.objects.filter(palestrante=lecturer)
+ c = {'lecturer': lecturer, 'talks': talks}
+ return render_to_response('eventos/talk-list.html', Context(c),
+ context_instance=RequestContext(request))
+
+def talk_details(request, tid):
+ """Shows a form to edit a talk
+ """
+ entity = get_object_or_404(Trabalho, pk=tid)
+ FormKlass = form_for_instance(entity)
+ form = FormKlass(request.POST or None)
+ if request.POST and form.is_valid():
+ form.save()
+
+ c = {'form': form}
+ return render_to_response('eventos/talk-details.html', Context(c),
+ context_instance=RequestContext(request))
+
+def talk_delete(request, tid):
+ """Drops a talk but only if the logged in user is its owner.
+ """
+ entity = get_object_or_404(Trabalho, pk=tid)
+ palestrante = request.user.palestrante_set.get()
+ owner = Trabalho.objects.filter(pk=tid, palestrante=palestrante)
+ if not owner:
+ return HttpResponseForbidden('<h2>You are not '
+ 'allowed to edit '
+ 'this info.<h2>')
+ entity.delete()
+ return HttpResponseRedirect('/lecturer/%d/talks/' % palestrante.id)
+
+def talk_add(request):
+ """Shows a form to the lecturer send a talk
+ """
+ palestrante = request.user.palestrante_set.get()
+ FormKlass = form_for_model(Trabalho)
+ form = FormKlass(request.POST or None)
+ if request.POST and form.is_valid():
+ form.save()
+ return HttpResponseRedirect('/lecturer/%d/talks/' % palestrante.id)
+
+ c = {'form': form}
+ return render_to_response('eventos/talk-add.html', Context(c),
+ context_instance=RequestContext(request))