mardi 19 décembre 2017

Flask-SqlAlchemy Checkbox - Getting empty list

I have a site with a database (orders and customers/users) with many records and I am trying to add checkboxes so I can delete multiple records of this db. Here are the parts of my code: HTML CODE (with "<",">" in the input command):


    

Python CODE:


    @mod_order.route('_delete_multiple_confirmation', methods=['GET', 'POST'])
    def delete_multiple_orders_confirmation():
        orders = (request.form.getlist('select_button'))
        user_id = request.args.get('user_id')
        response_context = {'orders': orders, 'user_id': user_id}
        return render_template('delete_multiple_order_confirmation.html', **response_context)

The result of the request.form.getList is an empty list. I need it to have the list of the checked records in order to delete them via another function. I found similar stuff here but none of them solved my problem (I guess it's something very simple and I'll knock my head on the wall when I find out). Thanks in advance




Aucun commentaire:

Enregistrer un commentaire