def new_cargo(request): if request.method =='POST' : formulario = CargoForm(request.POST, request.FILES) if formulario.is_valid() : formulario.save() return HttpResponseRedirect('/organizacion') else: formulario = CargoForm() return render_to_response('cargo/new_cargo.html', {'formulario' :formulario}, context_instance=RequestContext(request))
def update_cargo(request, id_cargo): cargo = get_object_or_404(Cargos, pk = id_cargo) if request.method == 'POST': formulario = CargoForm(request.POST, instance = cargo) if formulario.is_valid(): formulario.save() return HttpResponseRedirect('/cargo/option') else: formulario = CargoForm(instance = cargo) return render_to_response('cargo/update_cargo.html', {'formulario' :formulario}, context_instance=RequestContext(request))
def new_cargo(request): if request.method == 'POST': formulario = CargoForm(request.POST, request.FILES) if formulario.is_valid(): formulario.save() return HttpResponseRedirect('/organizacion') else: formulario = CargoForm() return render_to_response('cargo/new_cargo.html', {'formulario': formulario}, context_instance=RequestContext(request))
def update_cargo(request, id_cargo): cargo = get_object_or_404(Cargos, pk=id_cargo) if request.method == 'POST': formulario = CargoForm(request.POST, instance=cargo) if formulario.is_valid(): formulario.save() return HttpResponseRedirect('/cargo/option') else: formulario = CargoForm(instance=cargo) return render_to_response('cargo/update_cargo.html', {'formulario': formulario}, context_instance=RequestContext(request))