Basically I want to return the contents of create_user in the register function to use to save to my database. I am a complete beginner. What am I misunderstanding?
def register():
form = SignupForm(request.form)
if request.method == 'POST' and form.validate():
create_user = ({'username' : form.username.data, 'email' : form.email.data,
'password': form.password.data})
flash('Thanks for registering')
return create_user, redirect(url_for('loggedin.html'))
return render_template('get-started.html', form=form)
create_user = register()
doc_id, doc_rev = db.save(create_user)
Your indenting is wrong; you want:
Indenting delineates blocks of code. You need to indent everything inside the function to show that it is the code corresponding with that function, and everything inside the
if. You haven’t indented for theif.