Commit 7b515086 by Tom Christie

Error on double underscore ordering with CursorPagination. Refs #3221.

parent 18c93912
...@@ -665,6 +665,11 @@ class CursorPagination(BasePagination): ...@@ -665,6 +665,11 @@ class CursorPagination(BasePagination):
'Using cursor pagination, but no ordering attribute was declared ' 'Using cursor pagination, but no ordering attribute was declared '
'on the pagination class.' '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)), ( assert isinstance(ordering, (six.string_types, list, tuple)), (
'Invalid ordering. Expected string or tuple, but got {type}'.format( 'Invalid ordering. Expected string or tuple, but got {type}'.format(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment