[web2py] Re: Auth_user add username field
It's easier than that ... just change username=True in db.py, all the web2py components (e.g., log in form, auth_user table, log in menu, etc.) will now support username ... auth.define_tables(username=True, signature=True) On Wednesday, March 23, 2016 at 5:46:38 PM UTC-4, Jerry Liu wrote: > > Hello, all > > I want to add a *username* field to auth_user table. I figured out I can > use the following line of code to do so, but how can I use *username *instead > of *email *in login and registration process? > > auth.settings.extra_fields[auth.settings.table_user_name] = [ Field] > > > -- 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.
[web2py] Re: Auth_user add username field
Not sure if I understood, you mean I still have to make changes on View and Controller, right? because adding this line doesn't change anything on login and registration views. On Wednesday, March 23, 2016 at 4:12:49 PM UTC-7, Michael Beller wrote: > > It's easier than that ... just change username=True in db.py, all the > web2py components (e.g., log in form, auth_user table, log in menu, etc.) > will now support username ... > > auth.define_tables(username=True, signature=True) > > > > On Wednesday, March 23, 2016 at 5:46:38 PM UTC-4, Jerry Liu wrote: >> >> Hello, all >> >> I want to add a *username* field to auth_user table. I figured out I can >> use the following line of code to do so, but how can I use *username >> *instead >> of *email *in login and registration process? >> >> auth.settings.extra_fields[auth.settings.table_user_name] = [ Field] >> >> >> -- 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.
[web2py] Re: Auth_user add username field
no changes should be required to any controller or view. Everything is handled by the line: return dict(form=auth()) in the default controller (in combination with the default/user.html). The line in db.py just tells auth whether to use a username or email. On Wednesday, March 23, 2016 at 8:16:42 PM UTC-4, Jerry Liu wrote: > > Not sure if I understood, you mean I still have to make changes on View > and Controller, right? > because adding this line doesn't change anything on login and registration > views. > > On Wednesday, March 23, 2016 at 4:12:49 PM UTC-7, Michael Beller wrote: >> >> It's easier than that ... just change username=True in db.py, all the >> web2py components (e.g., log in form, auth_user table, log in menu, etc.) >> will now support username ... >> >> auth.define_tables(username=True, signature=True) >> >> >> >> On Wednesday, March 23, 2016 at 5:46:38 PM UTC-4, Jerry Liu wrote: >>> >>> Hello, all >>> >>> I want to add a *username* field to auth_user table. I figured out I >>> can use the following line of code to do so, but how can I use *username >>> *instead of *email *in login and registration process? >>> >>> auth.settings.extra_fields[auth.settings.table_user_name] = [ Field] >>> >>> >>> -- 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.
[web2py] Re: Auth_user add username field
Thanks! It worked! I also want to hide First and Last Name fields. At least, I don't want them to be shown on the registration page. Any ideas? On Wednesday, March 23, 2016 at 5:43:14 PM UTC-7, Michael Beller wrote: > > no changes should be required to any controller or view. Everything is > handled by the line: > return dict(form=auth()) > > in the default controller (in combination with the default/user.html). > > The line in db.py just tells auth whether to use a username or email. > > On Wednesday, March 23, 2016 at 8:16:42 PM UTC-4, Jerry Liu wrote: >> >> Not sure if I understood, you mean I still have to make changes on View >> and Controller, right? >> because adding this line doesn't change anything on login and >> registration views. >> >> On Wednesday, March 23, 2016 at 4:12:49 PM UTC-7, Michael Beller wrote: >>> >>> It's easier than that ... just change username=True in db.py, all the >>> web2py components (e.g., log in form, auth_user table, log in menu, etc.) >>> will now support username ... >>> >>> auth.define_tables(username=True, signature=True) >>> >>> >>> >>> On Wednesday, March 23, 2016 at 5:46:38 PM UTC-4, Jerry Liu wrote: Hello, all I want to add a *username* field to auth_user table. I figured out I can use the following line of code to do so, but how can I use *username *instead of *email *in login and registration process? auth.settings.extra_fields[auth.settings.table_user_name] = [ Field] -- 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.
[web2py] Re: Auth_user add username field
yes - I think something like this could/should work: db.auth_user.first_name.readable = False On Wednesday, March 23, 2016 at 8:49:42 PM UTC-4, Jerry Liu wrote: > > Thanks! It worked! > > I also want to hide First and Last Name fields. At least, I don't want > them to be shown on the registration page. Any ideas? > > On Wednesday, March 23, 2016 at 5:43:14 PM UTC-7, Michael Beller wrote: >> >> no changes should be required to any controller or view. Everything is >> handled by the line: >> return dict(form=auth()) >> >> in the default controller (in combination with the default/user.html). >> >> The line in db.py just tells auth whether to use a username or email. >> >> On Wednesday, March 23, 2016 at 8:16:42 PM UTC-4, Jerry Liu wrote: >>> >>> Not sure if I understood, you mean I still have to make changes on View >>> and Controller, right? >>> because adding this line doesn't change anything on login and >>> registration views. >>> >>> On Wednesday, March 23, 2016 at 4:12:49 PM UTC-7, Michael Beller wrote: It's easier than that ... just change username=True in db.py, all the web2py components (e.g., log in form, auth_user table, log in menu, etc.) will now support username ... auth.define_tables(username=True, signature=True) On Wednesday, March 23, 2016 at 5:46:38 PM UTC-4, Jerry Liu wrote: > > Hello, all > > I want to add a *username* field to auth_user table. I figured out I > can use the following line of code to do so, but how can I use *username > *instead of *email *in login and registration process? > > auth.settings.extra_fields[auth.settings.table_user_name] = [ Field] > > > -- 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.
Re: [web2py] Re: Auth_user add username field
how to set string size in sql form db.define_table('stud_personal', Field('phone_no',string(10), requires=IS_NOT_EMPTY())) is it correct? On Thu, Mar 24, 2016 at 7:21 AM, Michael Beller wrote: > yes - I think something like this could/should work: > > db.auth_user.first_name.readable = False > > > > On Wednesday, March 23, 2016 at 8:49:42 PM UTC-4, Jerry Liu wrote: >> >> Thanks! It worked! >> >> I also want to hide First and Last Name fields. At least, I don't want >> them to be shown on the registration page. Any ideas? >> >> On Wednesday, March 23, 2016 at 5:43:14 PM UTC-7, Michael Beller wrote: >>> >>> no changes should be required to any controller or view. Everything is >>> handled by the line: >>> return dict(form=auth()) >>> >>> in the default controller (in combination with the default/user.html). >>> >>> The line in db.py just tells auth whether to use a username or email. >>> >>> On Wednesday, March 23, 2016 at 8:16:42 PM UTC-4, Jerry Liu wrote: Not sure if I understood, you mean I still have to make changes on View and Controller, right? because adding this line doesn't change anything on login and registration views. On Wednesday, March 23, 2016 at 4:12:49 PM UTC-7, Michael Beller wrote: > > It's easier than that ... just change username=True in db.py, all the > web2py components (e.g., log in form, auth_user table, log in menu, etc.) > will now support username ... > > auth.define_tables(username=True, signature=True) > > > > On Wednesday, March 23, 2016 at 5:46:38 PM UTC-4, Jerry Liu wrote: >> >> Hello, all >> >> I want to add a *username* field to auth_user table. I figured out I >> can use the following line of code to do so, but how can I use *username >> *instead of *email *in login and registration process? >> >> auth.settings.extra_fields[auth.settings.table_user_name] = [ Field] >> >> >> -- > 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. > -- 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.