def addTipoDeSala(request): if request.method == "POST": form = FormTipoDeSala(request.POST) if form.is_valid(): form.save() return render_to_response("geral/salvo.html", context_instance=RequestContext(request)) else: form = FormTipoDeSala() return render_to_response("secretaria/novoTipoSala.html", {'form': form}, context_instance=RequestContext(request))
def editarTipoSala(request, nr_tipo): editTipo = get_object_or_404(TipoDeSala, pk=nr_tipo) if request.method == "POST": form = FormTipoDeSala(request.POST, instance=editTipo) if form.is_valid(): form.save() return render_to_response("geral/salvo.html", context_instance=RequestContext(request)) else: form = FormTipoDeSala(instance=editTipo) return render_to_response("secretaria/editarTipoSala.html", {'editTipo': editTipo, 'form': form} , context_instance=RequestContext(request))