mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Error on double underscore ordering with CursorPagination. Refs #3221.
This commit is contained in:
parent
18c9391218
commit
7b51508600
|
@ -665,6 +665,11 @@ class CursorPagination(BasePagination):
|
|||
'Using cursor pagination, but no ordering attribute was declared '
|
||||
'on the pagination class.'
|
||||
)
|
||||
assert '__' not in ordering, (
|
||||
'Cursor pagination does not support double underscore lookups '
|
||||
'for orderings. Orderings should be an unchanging, unique or '
|
||||
'nearly-unique field on the model, such as "-created" or "pk".'
|
||||
)
|
||||
|
||||
assert isinstance(ordering, (six.string_types, list, tuple)), (
|
||||
'Invalid ordering. Expected string or tuple, but got {type}'.format(
|
||||
|
|
Loading…
Reference in New Issue
Block a user