Esempio n. 1
0
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, })
Esempio n. 2
0
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,
    })
Esempio n. 3
0
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, })
Esempio n. 4
0
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,
    })