diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index 862941e79..2b51b3295 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -658,7 +658,7 @@ class CursorPagination(BasePagination): for i in range(len(ordering)): # The first operands need to be equals # the last operands need to be gt - equals = list(ordering[:i+2]) + equals = list(ordering[:i + 2]) greater_than_q = q_objects_compare[equals.pop()] sub_filters = [q_objects_equals[e] for e in equals] sub_filters.append(greater_than_q) diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 55c4e8833..fb3182b51 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -1,5 +1,4 @@ import pytest -import json import re import operator @@ -13,6 +12,7 @@ from django.test import TestCase from rest_framework import ( exceptions, filters, generics, pagination, serializers, status ) +from rest_framework.utils import json from rest_framework.pagination import PAGE_BREAK, PageLink from rest_framework.request import Request from rest_framework.test import APIRequestFactory