See https://groups.google.com/d/msg/web2py/LvR7mGFX7UQ/VN5H6AS-AQAJ.

Anthony

On Thursday, March 2, 2017 at 10:24:47 AM UTC-5, Carlos Cesar Caballero 
wrote:
>
> Hi, I need to check if a table field belongs to a given list of fields, 
> I write this, but is not working: 
>
> fields_list = [db.mytable.myfield] 
>
> table = db.mytable 
>
> for field in table: 
>      if field in fields_list: 
>              print field 
>
> Is matching all fields in table (prints all table fields). 
>
> As a quick solution I use: 
>
> if field.name in [f.name for f in fields_list]: 
>
> But it don't feel like a good solution. 
>
> What will be the proper way to achieve that? 
>
> Greetings. 
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to