Exemplo n.º 1
0
def index():
    form = ContactForm()
    if form.validate_on_submit():
        if request.method == 'POST':
            send_contact_email(form)
            flash(f'Your message has been sent!', 'success')
            return redirect(url_for('index'))
    return render_template('home.html', form=form)
Exemplo n.º 2
0
def contact():
    name = "Taras"
    category = "General"
    email = "*****@*****.**"
    message = "Hello form!"
    form = ContactForm()

    if form.validate_on_submit():
        app.logger.info(
            f"Contact Form - Category ({type(form.category.value)}: {form.category.value}"
        )
        name, category, email, message = form.name.data, form.category.data, form.email.data, form.message.data
        form.name.data, form.category.data, form.email.data, form.message.data = "", "", "", ""
        # return flask.url_for(".index")

    return flask.render_template("contact.html",
                                 form=form,
                                 name=name,
                                 category=category,
                                 email=email,
                                 message=message)