Пример #1
0
 def get_previous_link(self):
     if not self.page.has_previous():
         return None
     url = self.request.build_absolute_uri()
     page_number = self.page.previous_page_number()
     if page_number == 1:
         return remove_query_param(url, self.page_query_param)
     return replace_query_param(url, self.page_query_param, page_number)
Пример #2
0
    def get_previous_link(self):
        if self.offset <= 0:
            return None

        url = self.request.build_absolute_uri()

        if self.offset - self.limit <= 0:
            return remove_query_param(url, self.offset_query_param)

        offset = self.offset - self.limit
        return replace_query_param(url, self.offset_query_param, offset)
Пример #3
0
 def page_number_to_url(page_number):
     if page_number == 1:
         return remove_query_param(base_url, self.offset_query_param)
     else:
         offset = self.offset + ((page_number - current) * self.limit)
         return replace_query_param(base_url, self.offset_query_param, offset)
Пример #4
0
 def page_number_to_url(page_number):
     if page_number == 1:
         return remove_query_param(base_url, self.page_query_param)
     else:
         return replace_query_param(base_url, self.page_query_param, page_number)