Make Queries to Flask Controller Dynamic