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'))