示例#1
0
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')
示例#2
0
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)
示例#3
0
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)
示例#4
0
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)
示例#5
0
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')
示例#6
0
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)
示例#7
0
def title():
    form = TitleForm()
    redirect('description')
    return render_template('title.html', title='Title', form=form)