If you need to use field_list elsewhere and don't want it to be mutated by 
SQLFORM, then just pass a copy of it to SQLFORM instead.

import copy
form = SQLFORM(db.t_table_1, fields = copy.copy(field_list))

I suppose SQLFORM could be changed to do the copying itself.

Anthony

On Wednesday, February 11, 2015 at 12:10:53 PM UTC-5, Spokes wrote:
>
> After passing a list to SQLFORM's 'fields' parameter, it appears that 'id' 
> is prepended to that list. For example:
>
> field_list = ['field_1', 'field_2', 'field_3', ...]
> form = SQLFORM(db.t_table_1, fields = field_list)
>
> After the above statements are executed, 'field_list' is equal to ['id', 
> 'field_1', 'field_2', 'field_3', ...]. Has anyone else noticed the same 
> issue? If this is a common occurrence, rather than something idiosyncratic 
> to my program (and I haven't found anything in my code that's likely to 
> cause this to happen), it doesn't seem like a desirable behavior from 
> SQLFORM.
>

-- 
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