dimanche 23 juin 2019

How do I write checkbox state to database with flash and sqlite?

I'm getting the below error when trying to write a checkbox state from a form in my SQLite 3 database using Flask and Python3.

400 Bad Request: The browser (or proxy) sent a request that this server could not understand

My code is shown below:

App:

@app.route('/complete', methods=['POST'])
   def complete():
         todo = Todo.query.filter_by(id=request.form['name']).first()
         todo.complete = True
         db.session.commit()

HTML:

    <form action="" method="POST">
        <ul>
            
        </ul>
        <input type="submit" value="Update Items">
    </form>




Aucun commentaire:

Enregistrer un commentaire