From 24694ddcb4a17b7ae77d7d4d5f5e48a424e0e04a Mon Sep 17 00:00:00 2001 From: Maxime R Date: Fri, 18 Mar 2016 16:16:13 +0100 Subject: [PATCH] Fixed use of deprecated Query.aggregates In Django 1.8 [`Query.aggregates` is replaced by `annotations`](https://docs.djangoproject.com/es/1.9/releases/1.8/#aggregate-methods-and-modules). Using aggregates currently raises a `RemovedInDjango20Warning`. [Django's source](https://github.com/django/django/blob/1.8/django/db/models/sql/query.py#L192) --- rest_framework/filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/filters.py b/rest_framework/filters.py index 42e77d910..a4542df10 100644 --- a/rest_framework/filters.py +++ b/rest_framework/filters.py @@ -245,7 +245,7 @@ class OrderingFilter(BaseFilterBackend): ] valid_fields += [ (key, key.title().split('__')) - for key in queryset.query.aggregates.keys() + for key in queryset.query.annotations.keys() ] else: valid_fields = [