#NEWLINE# @ frontend . route ( '/signup' , methods = [ 'GET' , 'POST' ] ) #NEWLINE# def signup( ) : #NEWLINE# #INDENT# if current_user . is_authenticated ( ) : #NEWLINE# #INDENT# return redirect ( url_for ( 'user.index' ) ) #NEWLINE# #UNINDENT# form = SignupForm ( next = request . args . get ( 'next' ) ) #NEWLINE# if form . validate_on_submit ( ) : #NEWLINE# #INDENT# user = User ( ) #NEWLINE# user . user_detail = UserDetail ( ) #NEWLINE# form . populate_obj ( user ) #NEWLINE# db . session . add ( user ) #NEWLINE# db . session . commit ( ) #NEWLINE# if login_user ( user ) : #NEWLINE# #INDENT# return redirect ( ( form . next . data or url_for ( 'user.index' ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return render_template ( 'frontend/signup.html' , form = form )