flask_sqlalchemy_rest icon indicating copy to clipboard operation
flask_sqlalchemy_rest copied to clipboard

Get All Products returns "AttributeError: 'list' object has no attribute 'data'"

Open rene-schwabe opened this issue 5 years ago • 1 comments

The correct one is:

Get All Products

@app.route('/product', methods=['GET']) def get_products(): all_products = Product.query.all() result = products_schema.dump(all_products) return jsonify(result)

Wrong syntax: return jsonify(result.data)

rene-schwabe avatar Apr 30 '20 15:04 rene-schwabe

Thank you for the update. this was helpful.

jharemza avatar Aug 06 '20 19:08 jharemza