All,
I think I am asking for the impossible here. But I will ask anyway. I am using flask_sqlalchemy to build the tables and perform the queries, updates and insertions. I have multiple tables with the same structure with different names. A table called accounts which stores the name of the tables with the same structures. This is the important bits to know about. I have a page called transactions. When I call this page, I can append different names to the end. For example: Transactions/account1 Transactions/account2 Transactions/account3 . In the view for transactions I am doing the following (code extract) @app.route('/transactions/<account>') def transactions(account): if accounts != "Transactions": Accounts.query.filter_by(account_name =account).first_or_404() tables = Accounts.query.all() if account == 'Account1': records = Account1 elif account == 'Account2': records = Account2 records = records.query.order_by(records.date.desc) as I am saving each model object into the same variable depending on the full URL name. I am wondering if there is a better way in doing this rather than using a list of if tests? _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor