[web2py] Re: Default table schema for the Auth tables
One way is to look directly at the code in gluon/tools.py Under Class Auth try searching for define_table etc. I doubt that you would be able to safely remove fields though. On Thursday, 12 April 2012 23:23:21 UTC+1, cyan wrote: > > > Hi group, > > Is there anywhere I can find the default schema for the tables involved in > Auth provided by Web2py, namely, > > 'auth_user' > 'auth_group' > 'auth_membership' > 'auth_permission' > 'auth_event' > > They're described in the the manual but I would like to see the exact > field definitions for each of them, if possible. In addition, can we remove > fields from these tables? I know we can add extra fields or re-define the > whole table from scratch to replace them. Thanks! >
[web2py] Re: Default table schema for the Auth tables
Look at the define_tables method of the Auth class in /gluon/tools.py: http://code.google.com/p/web2py/source/browse/gluon/tools.py#1299. I'm not sure there's a good way to remove individual fields, but if you don't want them, you can always set their readable and writable attributes to False, so they won't appear in any forms (including registration and profile). Anthony On Thursday, April 12, 2012 6:23:21 PM UTC-4, cyan wrote: > > > Hi group, > > Is there anywhere I can find the default schema for the tables involved in > Auth provided by Web2py, namely, > > 'auth_user' > 'auth_group' > 'auth_membership' > 'auth_permission' > 'auth_event' > > They're described in the the manual but I would like to see the exact > field definitions for each of them, if possible. In addition, can we remove > fields from these tables? I know we can add extra fields or re-define the > whole table from scratch to replace them. Thanks! >
[web2py] Re: Default table schema for the Auth tables
cyan wrote: > definitions for each of them, if possible. In addition, can we remove > fields from these tables? I know we can add extra fields or re-define the I removed the name fields from auth_user and then some navbar function wrote "Hello None,". OK, some minor problem. But you can't know which fields are used at the moment without searching the complete source yourself. And the next update could require the existence of a field (see this navbar function, which wasn't used in earlier versions of the packaged views). web2py's auth is take it or leave it. PS: Please don't hang yourself up on my example. I said "minor problem".
[web2py] Re: Default table schema for the Auth tables
> web2py's auth is take it or leave it. I disagree. You can find the definition as Anthony suggests in the source of gluon/tools.py. You can add fields with auth.settings.extra_fields['auth_user']=[Field('address')] You should not remove fields. because they are the minimum necessary to make things work. You can remove first_name and last_name but life is easier if you simply make them invisible. You do not have to use {{=auth.navbar(...)}} in your layout.html.
[web2py] Re: Default table schema for the Auth tables
I think I will just make those fields invisible for now. Defining custom auth tables seem also a little risky, as it is unclear that which fields must be kept (except for auth_user, which is used as an example in the manual) for both current and future releases. Thanks all! On Friday, April 13, 2012 9:30:22 AM UTC-4, Massimo Di Pierro wrote: > > > web2py's auth is take it or leave it. > > I disagree. You can find the definition as Anthony suggests in the source > of gluon/tools.py. > You can add fields with > > auth.settings.extra_fields['auth_user']=[Field('address')] > > You should not remove fields. because they are the minimum necessary to > make things work. You can remove first_name and last_name but life is > easier if you simply make them invisible. > > You do not have to use {{=auth.navbar(...)}} in your layout.html. > >