Hi!,
Thank you for your answer, but it's not exactly what I want.
I'll explain better:
Let's say I have this table:
db.define_table('Hotel',
Field('name', label="Nombre del Hotel "),
Field('hotel_type', db.BookingCategory),
Field('hotel_chain_manager', db.auth_user))
And now I've a SQLFORM.grid like this:
form = SQLFORM.grid(db.Hotel,
searchable=True,
deletable=True,
details=True,
selectable=False,
create=True,
sortable=True,
fields=fields,
paginate=100,
maxtextlength=75,
links_in_grid=True)
as you can see, it is editable, but the Field "hotel_chain_manager" in the
form will be populated with ALL the users in db. This is not what I want, I
want that this field will be populated *only with the users in the "Admin"
membership*.
Kind Regards!!
On Tuesday, May 7, 2013 10:36:04 AM UTC+2, 黄祥 wrote:
>
> i think you can achieve it (in controller using grid) with
> editable = auth.has_membership('Admin')
>
> e.g.
> def booking():
> has_membership=auth.has_membership('Admin')
> grid=SQLFORM.grid(db.booking, editable=has_membership)
> return locals()
>
> best regards
>
> On Tuesday, May 7, 2013 3:16:11 PM UTC+7, José Manuel López wrote:
>>
>> Hi,
>> I've a " form = SQLFORM.grid " that let the user edit the rows.
>> In the edit form I want that one of the field populated only with
>> "Admins". Now I have this field populated with all the db.auth_user and is
>> huge and very hard to find the correct user.
>> How can I do it?, I'm thinking in something like:
>> *db.Hotel.chainManager **=IS_IN_DB( ¿¿??? )* .... how to express
>> only users with Admin membership?.
>>
>> Thank you.
>>
>
--
---
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/groups/opt_out.