def title(): form2 = TitleForm() if form2.validate_on_submit(): title = form2.title.data return redirect(url_for('index', title=title)) return render_template('title.html', form=form2, page='title')
def title(): form = TitleForm() if form.validate_on_submit(): header = form.title.data return redirect(url_for('index', header=header)) return render_template('form.html', title='Change Title', form=form)
def title(): form = TitleForm() # when form is submitted, redirect to home page, and pass title to change what the h1 tag says if form.validate_on_submit(): header = form.title.data return redirect(url_for('index', header=header)) return render_template('title.html', title='Title', form=form)
def title(): form = TitleForm() # handle form submission if form.validate_on_submit(): text = form.title.data return redirect(url_for('index', word=text)) return render_template('form.html', title='Title', form=form)
def title(): #create an instance of the form form = TitleForm() #write a conditional that checks if form was submitted properly, then do something with the Data if form.validate_on_submit(): return redirect(url_for('index', header=form.title.data)) # print(f'{form.title.data}') #name of form.nameofinput.data return render_template('form.html', form=form, title='Change Title')
def title(): form = TitleForm() if form.validate_on_submit(): header = form.title.data data = Title.query.get(1) data.title = header # add to session and commit db.session.add(data) db.session.commit() flash(f'You have changed the title to {header}') return redirect(url_for('index')) return render_template('form.html', title='Change Title', form=form)