def nueva_pelicula(request): if request.method == "POST": form = PeliculasForm(request.POST) print request.POST if form.is_valid(): pelicula = form.save() pelicula.save() return redirect('lista_peliculas') else: form = PeliculasForm return render(request,'peliculas/pelicula_nueva.html',{'form':form, 'etiqueta':'Nueva'})
def editar_pelicula(request, pk): peliculas = get_object_or_404(Peliculas, pk = pk) if request.method == "POST": form = PeliculasForm(request.POST, instance = peliculas) print request.POST if form.is_valid(): peliculas = form.save() peliculas.save() return redirect('lista_peliculas') else: form = PeliculasForm (instance=peliculas) return render(request,'peliculas/pelicula_nueva.html',{'form':form, 'etiqueta':'Actualizar'})