This may help:
http://www.web2pyslices.com/main/slices/take_slice/102

On Nov 23, 3:58 pm, mdipierro <[email protected]> wrote:
> No. You can make a SQLFORM.factory(table1,table2) but it would no DB
> IO so after accepts you would have to do some manual work
>
> On Nov 23, 3:46 pm, appydev <[email protected]> wrote:
>
> > Thank you very much for your response.
>
> > But I still have a doubt:
>
> > Is it possible to modify the registration form to insert data into two
> > tables?
>
> > where one of the tables is auth_user.
>
> > 2010/11/23 mdipierro <[email protected]>
>
> > > On Nov 23, 7:40 am, appydev <[email protected]> wrote:
> > > > Greetings.
>
> > > > I have a problem, I hope you can help me.
>
> > > > I have two models: Teacher, Student. Each with different attributes.
>
> > > > It occurred to me to implement them, linking tables:
>
> > > > db.define_table('teacher',
> > > >                         Field('person', length=64), 
> > > > requires=IS_IN_DB(db,
> > > > 'auth_user.uuid')),
> > > >                          ...
>
> > > > db.define_table('student',
> > > >                         Field('person', length=64), 
> > > > requires=IS_IN_DB(db,
> > > > 'auth_user.uuid')),
> > > >                          ...
>
> > > > Maybe not the best way to do it if they think of a better, please I'd
> > > like
> > > > to hear.
>
> > > > The problem is that I want to make a registration form to "Teacher." But
> > > > generating Auth, just fields "auth_user.
>
> > > > How do I include in a form fields auth_user + fields teacher?
>
> > > Although this can be done the problem is workflow. When a person
> > > register, the person cannot decide to be a teacher. Somebody must
> > > appoint the teacher.
>
> > > I would:
> > > - give the auth_user table a field 'teacher' boolean and default to
> > > false
> > > - have an administrator use appadmin to turn the teacher flag to on
> > > -
>
> > > appydev
> > > View profile
> > >         More options Nov 23, 7:40 am
> > > From: appydev <[email protected]>
> > > Date: Tue, 23 Nov 2010 09:10:50 -0430
> > > Local: Tues, Nov 23 2010 7:40 am
> > > Subject: [web2py] Beginner Auth problem
> > > Reply | Reply to author | Forward | Print | Individual message | Show
> > > original | Remove | Report this message | Find messages by this author
>
> > > Greetings.
>
> > > I have a problem, I hope you can help me.
>
> > > I have two models: Teacher, Student. Each with different attributes.
>
> > > It occurred to me to implement them, linking tables:
>
> > > db.define_table('teacher',Field('person',db.auth_user,writable=False,readable=False,default=auth.user_id),...)
> > > - add code like:
>
> > > if auth.user and auth.user.teacher but not
> > > db(db.teacher.person==auth.user_id).count():
> > >    redirect(URL('page_to_create_teacher_record'))
>
>

Reply via email to