python - type error in sqlalchemy/flask query -
i wondering if on error have app making flask-sqlalchemy , postgres database. have list of years (ints). elements of list depend on year user selects. list make query below searching results in database have fiscal years matching years in list:
@main.route('/searchresults') def yearresults(): entries = db.session.query(post).filter(post.fiscalyear.in_(list)) return render_template('yearsearch.html', entries=entries)
when run this, however, get
typeerror: 'type' object not iterable
the error occurs on line of query (db.session.query(post).filter...)
i know code works when query 1 specific year, i'm trying work multiple unknowns. wondering if sees solution or better way this.
thanks in advance!
list
in code python built-in object list
(type).
please provide actual list object there.
Comments
Post a Comment