def __init__(self,
                 request,
                 number,
                 current_number,
                 total_number,
                 querystring_key,
                 label=None,
                 default_number=1,
                 override_path=None):
        self._request = request
        self.number = number
        self.label = utils.text(number) if label is None else label
        self.querystring_key = querystring_key

        self.is_current = number == current_number
        self.is_first = number == 1
        self.is_last = number == total_number

        self.url = utils.get_querystring_for_page(
            request,
            number,
            self.querystring_key,
            default_number=default_number)
        path = iri_to_uri(override_path or request.path)
        self.path = '{0}{1}'.format(path, self.url)
Beispiel #2
0
 def render(self, context):
     # This template tag could raise a PaginationError: you have to call
     # *paginate* or *lazy_paginate* before including the getpages template.
     data = utils.get_data_from_context(context)
     pages = models.ShowItems(
         context['request'],
         data['page'],
         data['querystring_key'],
         default_number=data['default_number'],
         override_path=data['override_path'],
     )
     return utils.text(pages)
 def render(self, context):
     # This template tag could raise a PaginationError: you have to call
     # *paginate* or *lazy_paginate* before including the getpages template.
     data = utils.get_data_from_context(context)
     pages = models.ShowItems(
         context['request'],
         data['page'],
         data['querystring_key'],
         default_number=data['default_number'],
         override_path=data['override_path'],
     )
     return utils.text(pages)
    def __init__(
            self, request, number, current_number, total_number,
            querystring_key, label=None, default_number=1, override_path=None):
        self._request = request
        self.number = number
        self.label = utils.text(number) if label is None else label
        self.querystring_key = querystring_key

        self.is_current = number == current_number
        self.is_first = number == 1
        self.is_last = number == total_number

        self.url = utils.get_querystring_for_page(
            request, number, self.querystring_key,
            default_number=default_number)
        path = iri_to_uri(override_path or request.path)
        self.path = '{0}{1}'.format(path, self.url)
Beispiel #5
0
    def __init__(self, request, number, current_number, *args, **kwargs):
        total_number = kwargs.get('total_number')
        querystring_key = kwargs.get('querystring_key', 'page')
        label = kwargs.get('label', None)
        default_number = kwargs.get('default_number', 1)
        override_path = kwargs.get('override_path', None)
        self._request = request
        self.number = number
        self.label = utils.text(number) if label is None else label
        self.querystring_key = querystring_key

        self.is_current = number == current_number
        self.is_first = number == 1
        self.is_last = number == total_number

        self.url = utils.get_querystring_for_page(
            request,
            number,
            self.querystring_key,
            default_number=default_number)
        path = iri_to_uri(override_path or request.path)
        self.path = '{0}{1}'.format(path, self.url)