customizing field's visibility in user's profile

42 views
Skip to first unread message

Vlad

unread,
Jun 7, 2022, 4:32:54 PM6/7/22
to web2py-users
I added a few fields to auth_user, but they are for internal usage, so I don't want users to see those when they are logged in. How do I manage the visibility of the fields in the user profile?

Jim S

unread,
Jun 8, 2022, 11:01:24 AM6/8/22
to web2py-users
Can you just set readable and writable to False?

-Jim

Gaurav Vichare

unread,
Jun 9, 2022, 4:54:26 AM6/9/22
to web2py-users
In controllers/default.py, inside user function set readable and writable to False for the fields that you want to hide.

def user():
    db.auth_user.field_name.readable = False
    db.auth_user.field_name.writable = False
    return dict(form=auth())

Vlad

unread,
Jun 9, 2022, 8:36:07 AM6/9/22
to web2py-users
Thank you, Jim, I was aware of this parameter, but I wasn't sure where exactly to set it. But just got the answer. Thank you very much.

Vlad

unread,
Jun 9, 2022, 8:36:22 AM6/9/22
to web2py-users
Got it, thank you very much!
Reply all
Reply to author
Forward
0 new messages