Skip to content

Commit

Permalink
replace walrus operator
Browse files Browse the repository at this point in the history
  • Loading branch information
eaguad1337 committed Oct 25, 2023
1 parent 3904e65 commit dc9a815
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/collapsar/Resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def fields(cls):
def paginate(cls, collapsar_request: "CollapsarRequest"):
"""Paginate the resource."""
search_model = cls.model
if search_string := collapsar_request.input('search'):
search_string = collapsar_request.input('search')

if search_string:
for field in cls.search_fields:
search_model = search_model.or_where(field, 'like', f'%{search_string}%')

Expand Down

0 comments on commit dc9a815

Please sign in to comment.