@expenses.route('/expense/search', methods=['POST'])
@login_required
def search():

    model = Expenses(session.get('logged_in_user'))

    # query
    query = request.form['q'] if 'q' in request.form else ""

    # fetch entries
    entries = model.get_entries()

    # filter
    entries = entries.filter(ExpensesTable.description.like("%"+query+"%"))

    # categories
    categories = model.get_categories()

    # date ranges for the template
    date_ranges = get_date_ranges()

    return render_template('admin_search_expenses.html', **locals())
Search expenses
dataset/ETHPy150Open radekstepan/FlaskBudget/presenters/expenses.py/search