def editar(request, pk): if request.method == "POST": ropa = Ropa.objects.get(id=request.POST['id']) form = RopaForm(request.POST, instance=ropa) #print request.POST if form.is_valid(): ropa = form.save() ropa.save() return redirect('listar') else: form = RopaForm(instance=ropa) return render(request,'ropa/ropa_nueva.html',{'form':form, 'etiqueta':'Actualizar'})
def nuevo(request): #pass if request.method == "POST": form = RopaForm(request.POST) print request.POST if form.is_valid(): ropa = form.save() ropa.save() return redirect('ropa.views.listar') else: form = RopaForm return render(request,'ropa/ropa_nueva.html',{'form':form, 'etiqueta':'Nuevo'})