  
      def get_next_link(self):
          if not self.has_next:
              return None
          last_item = self.page[-1]
          position = self.get_position_from_instance(last_item, self.ordering)
          cursor = Cursor(offset=0, reverse=False, position=position)
          encoded = encode_cursor(cursor)
          return replace_query_param(self.base_url, self.cursor_query_param, encoded)
  
      def get_ordering(self):
          return 'created'
 
</s> remove             cursor = None
 </s> add             self.cursor = None </s> remove 
    # def decode_cursor(self, encoded, ordering):
    #     items = urlparse.parse_qs(b64decode(encoded))
    #     return items.get(ordering)[0]

    # def encode_cursor(self, cursor, ordering):
    #     items = [(ordering, cursor)]
    #     return b64encode(urlparse.urlencode(items, doseq=True))
 </s> add  </s> remove     tokens = urlparse.parse_qs(b64decode(encoded))
 </s> add     tokens = urlparse.parse_qs(b64decode(encoded), keep_blank_values=True) </s> remove             cursor = decode_cursor(encoded)
 </s> add             self.cursor = decode_cursor(encoded)
        compare = self.get_position_from_instance(self.next_item, self.ordering)
        offset = 0
        for item in reversed(self.page):
            position = self.get_position_from_instance(item, self.ordering)
            if position != compare:
                # The item in this position and the item following it
                # have different positions. We can use this position as
                # our marker.
                break

            # The item in this postion has the same position as the item
            # following it, we can't use it as a marker position, so increment
            # the offset and keep seeking to the previous item.
            compare = position
            offset += 1

        else:
            if self.cursor is None:
                # There were no unique positions in the page, and we were
                # on the first page, ie. there was no existing cursor.
                # Our cursor will have an offset equal to the page size,
                # but no position to filter against yet.
                offset = self.page_size
                position = ''
            else:
                # There were no unique positions in the page.
                # Use the position from the existing cursor and increment
                # it's offset by the page size.
                offset = self.cursor.offset + self.page_size
                position = self.cursor.position

        cursor = Cursor(offset=offset, reverse=False, position=position)
  
      def get_next_link(self):
          if not self.has_next:
              return None
        compare = self.get_position_from_instance(self.next_item, self.ordering)
        offset = 0
        for item in reversed(self.page):
            position = self.get_position_from_instance(item, self.ordering)
            if position != compare:
                # The item in this position and the item following it
                # have different positions. We can use this position as
                # our marker.
                break

            # The item in this postion has the same position as the item
            # following it, we can't use it as a marker position, so increment
            # the offset and keep seeking to the previous item.
            compare = position
            offset += 1

        else:
            if self.cursor is None:
                # There were no unique positions in the page, and we were
                # on the first page, ie. there was no existing cursor.
                # Our cursor will have an offset equal to the page size,
                # but no position to filter against yet.
                offset = self.page_size
                position = ''
            else:
                # There were no unique positions in the page.
                # Use the position from the existing cursor and increment
                # it's offset by the page size.
                offset = self.cursor.offset + self.page_size
                position = self.cursor.position

        cursor = Cursor(offset=offset, reverse=False, position=position)
        compare = self.get_position_from_instance(self.next_item, self.ordering)
        offset = 0
        for item in reversed(self.page):
            position = self.get_position_from_instance(item, self.ordering)
            if position != compare:
                # The item in this position and the item following it
                # have different positions. We can use this position as
                # our marker.
                break

            # The item in this postion has the same position as the item
            # following it, we can't use it as a marker position, so increment
            # the offset and keep seeking to the previous item.
            compare = position
            offset += 1

        else:
            if self.cursor is None:
                # There were no unique positions in the page, and we were
                # on the first page, ie. there was no existing cursor.
                # Our cursor will have an offset equal to the page size,
                # but no position to filter against yet.
                offset = self.page_size
                position = ''
            else:
                # There were no unique positions in the page.
                # Use the position from the existing cursor and increment
                # it's offset by the page size.
                offset = self.cursor.offset + self.page_size
                position = self.cursor.position

        cursor = Cursor(offset=offset, reverse=False, position=position)
        compare = self.get_position_from_instance(self.next_item, self.ordering)
        offset = 0
        for item in reversed(self.page):
            position = self.get_position_from_instance(item, self.ordering)
            if position != compare:
                # The item in this position and the item following it
                # have different positions. We can use this position as
                # our marker.
                break

            # The item in this postion has the same position as the item
            # following it, we can't use it as a marker position, so increment
            # the offset and keep seeking to the previous item.
            compare = position
            offset += 1

        else:
            if self.cursor is None:
                # There were no unique positions in the page, and we were
                # on the first page, ie. there was no existing cursor.
                # Our cursor will have an offset equal to the page size,
                # but no position to filter against yet.
                offset = self.page_size
                position = ''
            else:
                # There were no unique positions in the page.
                # Use the position from the existing cursor and increment
                # it's offset by the page size.
                offset = self.cursor.offset + self.page_size
                position = self.cursor.position

        cursor = Cursor(offset=offset, reverse=False, position=position)
          encoded = encode_cursor(cursor)
          return replace_query_param(self.base_url, self.cursor_query_param, encoded)
  
      def get_ordering(self):
          return 'created'
keep keep keep keep replace replace replace keep keep keep keep keep
 Add offset support for cursor pagination 
rest_framework/pagination.py