def index(date=None, category=None, page=1, items_per_page=10): '''List expenses for the user''' model = Expenses(session.get('logged_in_user')) dict = entries.index(**locals()) for key in dict.keys(): exec(key + " = dict['" + key + "']") return render_template('admin_show_expenses.html', **locals())
def index(date=None, category=None, page=1, items_per_page=10): '''List income entries for the user''' model = Income(session.get('logged_in_user')) dict = entries.index(**locals()) for key in dict.keys(): exec(key + " = dict['" + key + "']") return render_template('admin_show_income.html', **locals())
def export(date=None, category=None, page=1, items_per_page=10): '''Export expenses on a filter''' model = Expenses(session.get('logged_in_user')) dict = entries.index(**locals()) for key in dict.keys(): exec(key + " = dict['" + key + "']") response = make_response(render_template('admin_export_expenses.html', **locals())) response.headers['Content-type'] = 'text/csv' response.headers['Content-disposition'] = 'attachment;filename=' + 'expenses-' + str(today_date()) + '.csv' return response
def export(date=None, category=None, page=1, items_per_page=10): '''Export income entries on a filter''' model = Income(session.get('logged_in_user')) dict = entries.index(**locals()) for key in dict.keys(): exec(key + " = dict['" + key + "']") response = make_response( render_template('admin_export_income.html', **locals())) response.headers['Content-type'] = 'text/csv' response.headers[ 'Content-disposition'] = 'attachment;filename=' + 'income-' + str( today_date()) + '.csv' return response