is it possible to extend t2_person in this way so that the user can
login with their name instead of email?
At the moment t2.py hardcodes the email field in login().

Baron


On Nov 3, 2:40 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> These two lines
>
> > db.t2_person.exposes=['name','email','password']
> > db.t2_person.displays=['name','email','password']
>
> mean nothing in web2py, they just define two new attributes of 
> thet2_persontable.
> these two attributes, by convention, are used by T2.
>
> The first says that only ['name','email','password'] fields should be
> displayed in create and update forms. The second says that only
> ['name','email','password'] should be displayed by
> t2.display(db.t2_person).
>
> The first is used as in
>
> form=SQLFORM(db.table,fields=db.table.exposes)
>
> On Nov 2, 7:09 pm, Oscar <[EMAIL PROTECTED]> wrote:
>
> > So,
>
> > Massimo,
>
> > what does mean these two lines? Sorry I'm a very new with programming
> > at python.
>
> > Thanks in advance,
>
> > Oscar.
>
> > On 3 nov, 10:29, Oscar <[EMAIL PROTECTED]> wrote:
>
> > > What does mean below lines?
>
> > > db.t2_person.exposes=['name','email','password']
> > > db.t2_person.displays=['name','email','password']
>
> > > Regards,
>
> > > Oscar.
>
> > > On 3 nov, 00:30, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > Normally you can do
>
> > > > db.define_table('base_table',SQLField('myfield'))
> > > > db.define_table('derived_table',db.base_table,SQLField('otherfield'))
>
> > > > (both base_table and derived_table are created)
>
> > > > or
>
> > > > from gluon.sql import SQLTable
> > > > base_table=SQLTable('base_table',SQLField('myfield'))
> > > > db.define_table('derived_table',base_table,SQLField('otherfield'))
>
> > > > (only derived_table is created)
>
> > > > In the case T2 things are different because you want to modify the
> > > > structure of a table used by T2.
> > > > You can do it.
> > > > All you need to do is define the table before you instantiate the T2
> > > > object. Something like this:
>
> > > >      db.define_table('t2_person',
> > > >                db.Field('name'),
> > > >                db.Field('email'),
> > > >                db.Field('registration_key'),
> > > >                db.Field('password','password'),
> > > >                db.Field('created_by_ip'),
> > > >                db.Field('created_on','datetime'))
> > > >      db.t2_person.name.requires=IS_NOT_EMPTY()
>
> > > > db.t2_person.email.requires=[IS_EMAIL(),IS_NOT_IN_DB(db,'t2_person.email')]
> > > >      db.t2_person.password.requires=[IS_NOT_EMPTY(),CRYPT()]
> > > >      db.t2_person.exposes=['name','email','password']
> > > >      db.t2_person.displays=['name','email','password']
>
> > > >      t2=T2(request,response,session,cache,T,db)
>
> > > > you can add fields to thet2_persontable but you must have the above
> > > > fields.
>
> > > > Massimo
>
> > > > On Nov 1, 11:33 pm, Oscar <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > I was looking for how to extend a model, I mean, I working with T2 and
> > > > > I want to add some more fields to t2_persona table, I tryed defining
> > > > > again the table in my new project but It didn't worked. Some oen knows
> > > > > how I can accomplish this?
>
> > > > > Regards,
>
> > > > > Oscar.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to