Esempio n. 1
0
File: views.py Progetto: urkh/erp
def nuevo_cliente(request):
    
    if request.method=='POST':
        form = FormClientes(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/clientes/')
    else:
        form = FormClientes()
    
    return render_to_response('add_cliente.html', {'form': form}, context_instance=RequestContext(request))
Esempio n. 2
0
File: views.py Progetto: urkh/erp
def cliente(request, id):
    cliente = Clientes.objects.get(id=id)

    if request.method=='POST':
        form = FormClientes(request.POST, instance=cliente)
        if form.is_valid():

            cliente = form.save(commit=False)
            cliente.id = request.id
            cliente.save()
            #form.save()
            return HttpResponseRedirect('/clientes/')
    else:
        form = FormClientes()

    return render_to_response('cliente.html', {'cliente':cliente}, context_instance=RequestContext(request))