def new_planificacion(request): if request.method =='POST' : formulario = PlanificacionForm(request.POST, request.FILES) if formulario.is_valid() : plani = formulario.save() plani.usuario = request.user plani.save() msm = "Se Registro Correctamente La Planificación Dentro de: </strong>" + str(plani.cargo) + "<strong>" messages.add_message(request, messages.INFO, msm) admin_log_addnition(request, plani, "Se Registro La Planificacion") return HttpResponseRedirect(reverse(index_planificacion)) else: formulario = PlanificacionForm() return render_to_response('planificacion/new_planificacion.html', {'formulario' :formulario}, context_instance=RequestContext(request))
def update_planificacion(request, id_plani): planificacion = get_object_or_404(Planificacion, pk = id_plani) if request.method == 'POST' : formulario = PlanificacionForm(request.POST, instance = planificacion) if formulario.is_valid : plani = formulario.save() msm = "Se Modifico Correctamente La Planificación Dentro de: </strong>" + str(plani.cargo) + "<strong>" messages.add_message(request, messages.INFO, msm) admin_log_change(request, plani, "Se Modifico La Planificacion") return HttpResponseRedirect(reverse(option_update_planificacion)) else: formulario = PlanificacionForm(instance=planificacion) return render_to_response('planificacion/update_planificacion.html',{ 'formulario':formulario, }, context_instance=RequestContext(request))