On Thursday, October 13, 2016 at 9:28:47 PM UTC-4, Jaimee S wrote:
>
> Hello All, 
>
> Im new to web2py and I can't seem to figure out how to access the 
> usernames of the registered users. I added username to the default login 
> and it renders just fine. In my controller I've tried various methods such 
> as: 
>
>
> def xx(): 
>  item = db(db.auth_user).select(db.auth_user.username.ALL) 
>

No, it is just .select(db.auth_user.username). But that assumes you only 
want the username field and no other fields. If you want all fields, then 
it is .select(db.auth_user.ALL). But that isn't necessary either, because 
as long as there is a query inside db(), you can leave the .select() empty, 
and you will get all fields by default -- so, just do:

all_users = db(db.auth_user).select()

This is all in the documentation.

Anthony

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