Thanks Duncan

My fault! :P
I was pointing to another table and I was missing the ".select()" and at
the end... stupid me haha
like this: record = db((db.*lugar*.id == request.args(0)) & (db.*ruta*.user_id
== auth.user['id']))

Whit this works perfect:
record = db((db.lugar.lugar_id == request.args(0)) & (db.lugar.user_id ==
auth.user['id'])).select()[0]
    form_edit_ruta = SQLFORM(db.lugar, record)

Cheers.
Chris.

El vie., 22 feb. 2019 a las 9:56, Ben Duncan (<linux...@gmail.com>)
escribió:

> Are you trying to join to db's ?
> If not, then try :
>
> ROW = db(db.lugar.user_id == auth.user['id']).select()
> or
> ROW = db.lugar[auth_user['id']]
>
> See:
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Shortcuts
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Feb 21, 2019 at 10:04 PM Christian Varas <chriiisti...@gmail.com>
> wrote:
>
>> Hello !
>> I'm trying to get a sqlform that display a specific entry, i've been able
>> to get it work like in the book but just with one condition
>> like this: record = db.rutas(request.args(0))
>>
>> i need to do something like this:
>> record = db.rutas.id == request.args(0) and db.lugar.user_id ==
>> auth.user['id']
>>
>> I've tried:
>> record = db(db.rutas.id == request.args(0) and db.lugar.user_id ==
>> auth.user['id'])
>> record = db((db.rutas.id == request.args(0)) & (db.lugar.user_id ==
>> auth.user['id']))
>> but it doesn't work.
>> i'm getting this error:
>> *<type 'exceptions.TypeError'> argument of type 'Query' is not iterable*
>>
>> this is my function
>> @auth.requires_login()
>> def EditarRutaIngresada():
>>     record = db.rutas.id == request.args(0) and db.lugar.user_id ==
>> auth.user['id']
>>     form_edit_ruta = SQLFORM(db.rutas, record)
>>
>>     return dict(form_edit_ruta=form_edit_ruta)
>>
>> anybody knows how to do this right ?
>>
>>
>> Thanks in advanced.
>> Cheers.
>> Chris.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to