By default, the "represent" attribute of a reference field is based on the 
"format" attribute of the table it references. So, you have two options -- 
you could either change the "format" attributes of the auth_user and 
auth_group tables:

db.auth_user._format = '%(first_name)s %(last_name)s'  # notice the "id" 
field is excluded

or you could directly change the "represent" attributes of the 
auth_membership.user_id and auth_membership.group_id fields:

db.auth_membership.user_id.represent = lambda id, row: '%(first_name)s 
%(last_name)s' % db.auth_user(id)

Note, if you exclude the "id" field from the representation, two users with 
the same name will appear identically in the list (that's why the default 
representation includes the "id" -- in order to ensure a unique set of 
values).

Anthony

On Saturday, August 22, 2015 at 7:11:12 AM UTC-4, icodk wrote:
>
> I made a form for editing  the auth_membership table using smart grid, it 
> works fine.
> The only issue I have is that the id of the user_id and the id of the 
> group_id are appended to the user name and to the group name.
> How can I get rid of this 'extra' addition ?
> For example the user John Smith is shown as: John Smith(15) both in the 
> create/edit and in the grid 
> The group named Teachers is shown as Teachers(4) 
>

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