<div>
Username: {{=form.custom.widget.username}}
Email: {{=form.custom.widget.email}}
Password: {{=form.custom.widget.password}}
{{=form.custom.submit}}
</div>
def register():
return dict(form=auth.register())
def login():
return dict(form=auth.login())
form = auth.register()
if form.process().accepted:
# Then what??
def user():
if request.args(0) == 'register':
for field in [list, of, fields]:
db.auth_user[field].readable = db.auth_user[field].writable = False
return dict(form=auth())
Did you also include form.custom.begin and form.custom.end (you need the latter, or the _formkey check will fail silently)? Anyway, if you just want to exclude some fields from the register form, you can set the readable and writable attributes to False within the user function:def user():
if request.args(0) == 'register':
for field in [list, of, fields]:
db.auth_user[field].readable = db.auth_user[field].writable = False
return dict(form=auth())Anthony
On Friday, September 6, 2013 5:17:23 PM UTC-4, Apple Mason wrote:
Oops, I do have form.custom.begin and form.custom.end. I had forgotten to type it here.
I also wanted a custom view for the registration, login, and whatever else, so my understanding is that I can do this by using form=auth.register() and form=auth.login(). Then in their respective views, I can format the html whatever way I want with form.custom.begin and form.custom.end.
{{if request.args(0) == 'login':}}
[code to show login form]
{{elif request.args(0) == 'register':}}
[code to show register form]
{{else:}}
{{=form # use defaults for other forms}}
{{pass}}Is form=auth.register() supposed to handle inserting the new user to the database? I've only dealt with handling it in the controller with 'if form.process().accepted', so looking at 'return(form=auth.register()) is a bit confusing.
def user():
if request.args(0) == 'register':
for field in [list, of, fields]:
db.auth_user[field].readable = db.auth_user[field].writable = False
return dict(form=auth())
db.auth_user['last_name'].readable = db.auth_user['last_name'].writable = False