The readable and writeable attributes of a field can be set conditionally
(e.g., depending on request parameters or user authorization) or changed at
any point in your code, so you could do:
db.define_table('auth_user', ...,
Field('approved', writeable = auth.has_membership('admin') and True or
False))
Or in the action that generates the form to be used by the admin user:
db.auth_user.approved.writeable = True
form = SQLFORM(db.auth_user, ...)
Anthony
On Thursday, January 5, 2012 2:26:54 PM UTC-5, lucas wrote:
>
> hello one and all,
>
> i have a field under a custom auth_user called "approved". it is
> writeable and readable False so that the users can not see or edit
> this field under the register form.
>
> but, i am also generating a form of the table where i want to be able
> to edit the "approved" field as the admin of the site. so i can see
> two possible ways of doing it. i can make the "approved" field
> writeable and remove it from the auto registration form somehow before
> it is sent from the server. or, leave the field writeable False, and
> then create the crud.update for the admin and then add this field
> manually to the crud object after it is created so that the admin can
> edit the field.
>
> please advise me into which of the two scenarios is best and exactly
> how to do it. thank you in advance and have a great day. lucas