Reputation: 101
@app.route('/modify/<id>/', methods = ['GET', 'POST'])
def modify(id):
if request.method == 'POST':
content = request.form['content']
desc = request.form['desc']
# degree = request.form['degree']
# time = datetime.datetime.utcnow()
todo = todos.find_one({"_id": ObjectId(id)})
todos.update_one({"_id": ObjectId(id)}, {"$set": {
"content": content,
"desc": desc
}})
return redirect("/")
todo = todos.find_one({"_id": ObjectId(id)})
return render_template('update.html', todo=todo)
I am trying to fetch the data from one html page and show it on the 2nd page alongwith updating on the 2nd page.
Upvotes: 0
Views: 27