Exemple #1
0
def nueva_pareja(request):
	if request.method=='POST':
		formulario = ParejaForm(request.POST, request.FILES)
		if formulario.is_valid():
			formulario.save()
			return HttpResponseRedirect('/parejas')
	else:
		formulario = ParejaForm()
	return render_to_response('parejaform.html',{'formulario':formulario}, context_instance=RequestContext(request))
Exemple #2
0
def nueva_pareja(request):
    if request.method == 'POST':
        formulario = ParejaForm(request.POST, request.FILES)
        if formulario.is_valid():
            formulario.save()
            return HttpResponseRedirect('/parejas')
    else:
        formulario = ParejaForm()
    return render_to_response('parejaform.html', {'formulario': formulario},
                              context_instance=RequestContext(request))
Exemple #3
0
def editar_pareja(request, idpareja):
	pareja = Pareja.objects.get(idpareja=idpareja)
	if request.method=='POST':
		form = ParejaForm(request.POST, instance = pareja)
		if form.is_valid():
			form.save()
		return HttpResponseRedirect('/parejas')
	else:
		form = ParejaForm(instance = pareja)
	return render_to_response('editar_pareja.html', {'form':form}, context_instance=RequestContext(request))
Exemple #4
0
def editar_pareja(request, idpareja):
    pareja = Pareja.objects.get(idpareja=idpareja)
    if request.method == 'POST':
        form = ParejaForm(request.POST, instance=pareja)
        if form.is_valid():
            form.save()
        return HttpResponseRedirect('/parejas')
    else:
        form = ParejaForm(instance=pareja)
    return render_to_response('editar_pareja.html', {'form': form},
                              context_instance=RequestContext(request))