Skip to content

Commit

Permalink
fix: django order exception with value ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Legtenborg committed May 13, 2024
1 parent a6df239 commit 4e0341a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/django_rest_aggregation/mixins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.decorators import action
from rest_framework.response import Response

Expand All @@ -9,7 +10,10 @@
class AggregationMixin:
@action(methods=["get"], detail=False, url_path="aggregation", url_name="aggregation")
def aggregation(self, request):
queryset = self.filter_queryset(self.get_queryset()).order_by()
queryset = self.get_queryset()

if DjangoFilterBackend in self.filter_backends:
queryset = DjangoFilterBackend().filter_queryset(request, queryset, self)

aggregator = Aggregator(request, queryset, self.get_aggregation_name())
filtered_queryset = self.filter_aggregated_queryset(aggregator.get_aggregated_queryset())
Expand Down

0 comments on commit 4e0341a

Please sign in to comment.