Hi massimo
First thanks for your great web2py.
I link 2 tables (user_auth and person) and create custom registration
form
here is the controller:
def register():
db.person.name.readable=db.person.name.writable=False
db.person.user_id.readable=db.person.user_id.writable=False
form=SQLFORM.factory(db.person,db.auth_user)
if form.accepts(request.vars):
id =
db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
form.vars.user_id=id
form.vars.name=form.vars.first_name+' '+form.vars.last_name
id = db.person.insert(**db.person._filter_fields(form.vars))
response.flash='Thanks for filling the form'
return dict(form=form)
and here is the view:
{{extend 'layout.html'}}
{{=form.custom.begin}}
<div id="register_person">
{{=TABLE(TR('Fist name',form.custom.widget.first_name),
TR('Last name',form.custom.widget.last_name),
TR('Country',form.custom.widget.country),
TR('Email',form.custom.widget.email),
TR('Password',form.custom.widget.password),
TR('Password again',form.custom.widget.password_two))}}
{{=form.custom.submit}}
</div>
{{=form.custom.end}}
I still get None for password_two field.
I use the latest web2py testing archive. I think the problem is in
linking the tables and not using default form auth().
The site i'm working on has 2-3 types of users stored in different
tables and they use default auth_user table credentials (email and
pass) to login in. So i want to make 3 different "register" controlers
for every type user.
Any suggestion is helpful?
Thanks
On Feb 20, 5:58 pm, Massimo Di Pierro <[email protected]>
wrote:
> fixed just now, please try it.
>
> On Feb 19, 11:36 pm, pbreit <[email protected]> wrote:
>
>
>
>
>
>
>
> > Did this get fixed?
>
> > I have this:
> > {{=form.custom.begin}}
> > {{=form.custom.widget.email}}
> > {{=form.custom.widget.password}}
> > {{=form.custom.widget.password_two}}
> > {{=form.custom.end}}
>
> > And it shows email and password fields and then the word "None".