The problem is that you return cliente=clientes[0] i.e. a single
client, not multimple Rows, but in view you loop over c{{for cliente
in cliente:}} as if cliente were Rows and not a single cliente.
My advice is:
def show():
''' ver cliente '''
nome = request.vars.nome
clientes=db(db.cliente.nome==nome).select(limitby=(0,1))
if not len(clientes): redirect(URL(r=request, f='clientes'))
return dict(cliente=clientes[0])
{{extend 'layout.html'}}
<h1>Clientes arquivados.</h1>
<h2>{{=cliente.id}}</h2>
<b>Nome: {{=A(cliente.nome, _href=URL(r=request, f='show?nome=%s'
% cliente.nome))}}</b> <br />
<b>Contacto:</b> {{=cliente.contacto}}<br />
<b>Email:</b> {{=cliente.email}}<br />
<b>Morada:</b> {{=cliente.morada}}<br />
<br />
Massimo
On Sep 9, 6:51 am, Carlos Aboim <[email protected]> wrote:
> Hi,
>
> I have the next files.
> I want to retrieve just a record from a list in database.
>
> controller ---> http://dpaste.com/hold/91386/
> view ---> http://dpaste.com/hold/91385/
>
> but it gives me the next error:
>
> error output ---> invalid function
>
> by the way, if the retrieved info has a special caracter it doesnt
> render giving a unicode error. How do I declare a coding other than in
> the controller that is already done?!
>
> thank you in advanced
> Carlos Aboim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---