def nuevoColor(request): if request.method == "POST": form = ColorForm(request.POST) print request.POST if form.is_valid(): color = form.save() color.save() return redirect('color.views.listaColor') else: form = ColorForm return render(request,'color/nuevoColor.html',{'form':form, 'etiqueta':'Nuevo'})
def editarColor(request, pk): color = get_object_or_404(Color, pk=pk) if request.method == "POST": form = ColorForm(request.POST, instance=color) #print request.POST if form.is_valid(): color = form.save() color.save() return redirect('color/listaColor.html') else: form = ColorForm(instance=color) return render(request,'color/nuevoColor.html',{'form':form, 'etiqueta':'Actualizar'})