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 the t2_person table 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