User:Pedro Sá Couto/TW/Commenting: Difference between revisions
< User:Pedro Sá Couto | TW
(Created page with "=STEPS= ====Leaving a comment is separated in 4 steps:==== 1. Filling the form with to leave a new comment to the Guidelines<br> 3. Submiting the request<br> 4. Displaying the...") |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
1. Filling the form with to leave a new comment to the Guidelines<br> | 1. Filling the form with to leave a new comment to the Guidelines<br> | ||
3. Submiting the request<br> | 3. Submiting the request<br> | ||
4. Displaying the | 4. Displaying the comment<br> | ||
=WHY?= | =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.<br> | |||
This is also a way to improve the input that users may give to how Tactical Watermarks is run. | |||
=PREVIEW= | =PREVIEW= | ||
====Printscreen from ''https://hub.xpub.nl/watermark/terms''==== | ====Printscreen from ''https://hub.xpub.nl/watermark/terms''==== | ||
<gallery> | <gallery> | ||
File: | File:termsform.png | ||
</gallery> | </gallery> | ||
Line 18: | Line 19: | ||
<source lang="python"> | <source lang="python"> | ||
#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')) | |||
</source> | </source> |
Latest revision as of 02:32, 15 June 2020
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'))