def adicionarCompromisso(request): form = CadastroCompromisso() if request.method == 'POST': form = CadastroCompromisso(request.POST) if form.is_valid(): agenda = Agenda() return agenda.inserirCompromisso(request) context_instance = RequestContext(request, { 'form' : form}) return render_to_response("professor/adicionar-compromisso.html", context_instance)
def editarCompromisso(request, id): c = get_object_or_404(Compromisso, pk=id) form = CadastroCompromisso(instance=c) if request.method == 'POST': form = CadastroCompromisso(request.POST) if form.is_valid(): agenda = Agenda() return agenda.editarCompromisso(request, id) context_instance = RequestContext(request, { 'form' : form}) return render_to_response("professor/editar-compromisso.html", context_instance)