Bird
0
0

Given this code snippet using CursorPagination, what will be the value of the next cursor if the current cursor is 'abc123' and page size is 2?

medium📝 component behavior Q13 of 15
Django - DRF Advanced Features
Given this code snippet using CursorPagination, what will be the value of the next cursor if the current cursor is 'abc123' and page size is 2?
class MyCursorPagination(CursorPagination):
    page_size = 2

paginator = MyCursorPagination()
next_cursor = paginator.get_next_link()
AA tuple with offset and limit values
BAn integer representing the next page number
CNone, because get_next_link() returns nothing
DA URL containing a cursor parameter with a new encoded cursor
Step-by-Step Solution
Solution:
  1. Step 1: Understand CursorPagination behavior

    CursorPagination returns URLs with encoded cursor tokens for next pages, not page numbers or tuples.
  2. Step 2: Analyze get_next_link() output

    get_next_link() returns a URL string containing the next cursor parameter for pagination.
  3. Final Answer:

    A URL containing a cursor parameter with a new encoded cursor -> Option D
  4. Quick Check:

    CursorPagination next link = URL with cursor [OK]
Quick Trick: CursorPagination returns URLs with cursor tokens, not numbers [OK]
Common Mistakes:
MISTAKES
  • Expecting page numbers from CursorPagination
  • Thinking get_next_link() returns None
  • Confusing limit/offset with cursor

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes