Skip to content

Commit

Permalink
don't desc sort attributes that have no desc() method
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaxxl committed Jul 2, 2024
1 parent 1b9be61 commit 4031a62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion safrs/jsonapi_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def jsonapi_sort(object_query, safrs_object):
# with a minus, in which case it MUST be descending.
sort_attr = sort_attr[1:]
attr = getattr(safrs_object, sort_attr, None)
if attr is not None:
if attr is not None and hasattr(attr, desc):
attr = attr.desc()
else:
attr = getattr(safrs_object, sort_attr, None)
Expand Down

0 comments on commit 4031a62

Please sign in to comment.