def gestionProfesor(request, accion="nuevo", profesorid=""): #profesorid = profesorid if (profesorid[-1]!='/') else profesorid[:-1] if (request.method == "POST" ) : form = ProfesorForm(request, accion, profesorid, "lee") if (form.is_valid()): form.save() return HttpResponseRedirect('/coordinacio/professorat') else: form = ProfesorForm(request, accion, profesorid) # CAMBIAR PLANTILLA PARA QUE RECIBA SOLO UN FORMULARIO return render_to_response('profesorGestion.html', {'form': form.usuarioForm, 'accion': accion, 'professorid': profesorid})
def ingresoP(request, id="", template_name="ingresoP.html"): if id: est = get_object_or_404(Profesor, pk=id) # Profesor.objects.get(pk=id) else: est = None if request.method == "POST": form = ProfesorForm(request.POST, instance=est) if form.is_valid(): form.save() messages.add_message(request, messages.SUCCESS, "Profesor modificado correctamente.") redirect_url = reverse("consultarProfesor") return HttpResponseRedirect(redirect_url) else: form = ProfesorForm(instance=est) return render_to_response(template_name, {"form": form, "id": id}, context_instance=RequestContext(request))
def gestionProfesor(request, user=None, accion="nuevo", profesorid=""): if (request.method == "POST" ) : form = ProfesorForm(request, accion, profesorid) if (form.is_valid()): form.save() return HttpResponseRedirect('/coordinacio/professorat/') else: form = ProfesorForm(request, accion, profesorid) return render_to_response('profesorGestion.html', locals())