Пример #1
0
Файл: views.py Проект: 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))
Пример #2
0
Файл: views.py Проект: 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))