python - How to generate a link to the form a user has submitted using flask? -


i trying build tool using python, flask, flask-wtforms, , flask-mail where:
a) user goes website , fills out form
b) after user fills out form, email sent details (for e.g. first name, last name, comment, etc) user filled out in form.

so far if user fills first name test, last name user, email testuser@example.com, , comment "this test comment", email following info:

name: test user
email: testuser@example.com
comment: test comment

what want further to:
a) send link in email should point information user submitted in form (i have build test page, formsubmitted.html user sees after form submitted)
b) once link opened email, should able see, reply, , give feedback user's initial comment (lets saying like, "your comment should be, "this test comment2" , not "this test comment")
c) finally, user should email link or can go , see comment posted ("this test comment2") along or initial comment ("this test comment")

is can done in flask , flask-mail? or using other module in python?

thank help.

my code:
__init__py file:

mail = mail(app) class myform(form):     firstname = stringfield('first name', [validators.length(min=3, max=35)])     lastname = stringfield('last name', [validators.length(min=3, max=35)])     email = stringfield('email address', [validators.length(min=4, max=35)])     comment = textareafield('comment', [validators.length(min=4, max=500)])  @app.route('/', methods=['get', 'post']) def index():     form = myform(request.form)     msg = message("email user: " + form.firstname.data + " " + form.lastname.data, sender='testuser@example.com', recipients=['testuser2@example.com'])       msg.html = "name: "  +  form.firstname.data + " " + form.lastname.data + \         " <br />" +  "email: " + form.email.data + \         "<br /> " + "comment: " + form.comment.data       mail.send(msg)     return render_template('formsubmitted.html', form=form) return render_template('index.html', form=form)  if __name__ == "__main__":     app.run(debug=true) 

index.html file:

{{ render_field(form.firstname) }} {{ render_field(form.lastname) }} {{ render_field(form.email) }} {{ render_field(form.comment) }} 

formsubmitted.html file:

{% autoescape false %} {{"name: " + form.firstname.data + " " + form.lastname.data + "<br />" + "email: " + form.email.data +  "<br /> " + "comment: " + form.comment.data}} {% endautoescape %} 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -