ishaj
ishaj

Reputation: 101

Getting http://127.0.0.1:5000/modify// with 404 not found error

enter image description here

@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

Answers (0)

Related Questions