Skip to content

Commit

Permalink
Apply model ordering by default
Browse files Browse the repository at this point in the history
  • Loading branch information
stevelacey committed Dec 8, 2021
1 parent 50390c3 commit 49a5a55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion worf/views/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ def get_processed_queryset(self):
queryset = (
apply_filterset(self.filter_set, queryset, filterset_kwargs)
.filter(self.search_query)
.order_by(*order_by)
.distinct()
)

Expand All @@ -162,6 +161,9 @@ def get_processed_queryset(self):
if key.endswith("!")
else queryset.filter(**{key: item})
)

if order_by:
queryset = queryset.order_by(*order_by)
except TypeError as e:
if settings.DEBUG:
raise HTTP420(f"Error, {self.lookup_kwargs}, {e.__cause__}")
Expand Down

0 comments on commit 49a5a55

Please sign in to comment.