def NewPaqueteView(request): if not request.user.is_anonymous(): return HttpResponseRedirect('/') if request.method=='POST': form = NewPaqueteForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/') else: form = NewPaqueteForm() return render(request, 'newPaquete.html', {'form':form, })
def NewPaqueteView(request): if not request.user.is_anonymous(): return HttpResponseRedirect('/') if request.method == 'POST': form = NewPaqueteForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/') else: form = NewPaqueteForm() return render(request, 'newPaquete.html', { 'form': form, })
def EditarPaquete(request, id_paquete): paquete = Paquete.objects.get(pk=id_paquete) if not request.user.is_anonymous(): return HttpResponseRedirect('/') if request.method == 'POST': form = NewPaqueteForm(request.POST, instance = paquete) if form.is_valid(): form.save() return HttpResponseRedirect('/') else: form = NewPaqueteForm(instance = paquete) return render(request, 'editarPaquete.html',{'form':form, })
def EditarPaquete(request, id_paquete): paquete = Paquete.objects.get(pk=id_paquete) if not request.user.is_anonymous(): return HttpResponseRedirect('/') if request.method == 'POST': form = NewPaqueteForm(request.POST, instance=paquete) if form.is_valid(): form.save() return HttpResponseRedirect('/') else: form = NewPaqueteForm(instance=paquete) return render(request, 'editarPaquete.html', { 'form': form, })