検索画面で値が入力された項目を、検索条件に加える際のロジックになります。
query = Model.query
param1 = request.args.get('param1')
if param1:
query = query.filter(
Model.param1.like(f'%{param1}%'))
param2 = request.args.get('param2')
if param2:
query = query.filter(Model.param2.like(f'%{param2}%'))
param3 = request.args.get('param3')
if param3:
query = query.filter(Model.param3.like(f'%{param3}%'))
result = paginate(page per_page)