User:Pedro Sá Couto/TW/Commenting

From XPUB & Lens-Based wiki

STEPS

Leaving a comment is separated in 4 steps:

1. Filling the form with to leave a new comment to the Guidelines
3. Submiting the request
4. Displaying the comment

WHY?

Tactical Watermarks will exist alongside its use. We ask users to give input on any changes that should or may be made to the Guidelines of the application.
This is also a way to improve the input that users may give to how Tactical Watermarks is run.

PREVIEW

Printscreen from https://hub.xpub.nl/watermark/terms

Python View

#Terms & Comment
# create table for comments
table_comment = db['commented']

@app.route('/write_comment', methods=['GET'])
def write_comment():
    return render_template('public/write_comment.html')

# from GET /write_comment render terms.html
@app.route('/terms', methods=['GET'])
def terms():
    comments = table_comment.find(order_by='-id')
    return render_template('public/terms.html', comments=comments)

# from POST /submit store data in the database and forward to the terms
@app.route('/submitcomment', methods=['POST'])
def submitcomment():
    comment = dict(name=request.form['name'], commenting=request.form['commenting'])
    table_comment.insert(comment)
    return redirect(url_for('terms'))