def show_more(context, label=None):
    """
    Show the link to get the next page in a Twitter-like pagination.
    Usage::
    
        {% show_more %}
    
    Alternatively you can override the label passed to the
    default template::
    
        {% show_more "even more" %}
    
    Must be called after {% paginate objects %}.
    """
    # this can raise a PaginationError 
    # (you have to call paginate before including the show more template)
    page = utils.get_page_from_context(context)
    # show the template only if there is a next page
    if page.has_next():
        request = context["request"]
        page_number = page.next_page_number()
        # querystring
        querystring_key = context["endless_querystring_key"]
        querystring = utils.get_querystring_for_page(request, page_number,
            querystring_key, default_number=context["endless_default_number"])
        return {
            'path': context["endless_override_path"] or request.path,
            'querystring_key': querystring_key,
            'querystring': querystring,
            'loading': settings.LOADING,
            'label': label,
        }
    # no next page, nothing to see
    return {}
Ejemplo n.º 2
0
def show_more_table(context, label=None, loading=endless_settings.LOADING):
    # this can raise a PaginationError
    # (you have to call paginate before including the show more template)
    page = utils.get_page_from_context(context)
    # show the template only if there is a next page
    if page.has_next():
        request = context["request"]
        page_number = page.next_page_number()
        # querystring
        querystring_key = context["endless_querystring_key"]
        querystring = utils.get_querystring_for_page(
            request,
            page_number,
            querystring_key,
            default_number=context["endless_default_number"])
        return {
            'path': context["endless_override_path"] or request.path,
            'querystring_key': querystring_key,
            'querystring': querystring,
            'loading': loading,
            'label': label,
            'request': request,
        }
    # no next page, nothing to see
    return {}
 def render(self, context):
     # this can raise a PaginationError 
     # (you have to call paginate before including the get pages template)
     page = utils.get_page_from_context(context)
     # unicode representation of the sequence of pages
     pages = models.PageList(context["request"], page, 
         context["endless_querystring_key"],
         default_number=context["endless_default_number"],
         override_path=context["endless_override_path"])
     return unicode(pages)
Ejemplo n.º 4
0
 def render(self, context):
     # this can raise a PaginationError 
     # (you have to call paginate before including the get pages template)
     page = utils.get_page_from_context(context)
     # unicode representation of the sequence of pages
     pages = models.PageList(context["request"], page, 
         context["endless_querystring_key"],
         default_number=context["endless_default_number"],
         override_path=context["endless_override_path"])
     return unicode(pages)
 def render(self, context):
     # this can raise a PaginationError 
     # (you have to call paginate before including the get pages template)
     page = utils.get_page_from_context(context)
     default_number = context.get("endless_default_number")
     
     # put the PageList instance in the context
     context[self.var_name] = models.PageList(context["request"], page,
         context["endless_querystring_key"],
         default_number=context["endless_default_number"],
         override_path=context["endless_override_path"])
     return ""
Ejemplo n.º 6
0
 def render(self, context):
     # this can raise a PaginationError 
     # (you have to call paginate before including the get pages template)
     page = utils.get_page_from_context(context)
     default_number = context.get("endless_default_number")
     
     # put the PageList instance in the context
     context[self.var_name] = models.PageList(context["request"], page,
         context["endless_querystring_key"],
         default_number=context["endless_default_number"],
         override_path=context["endless_override_path"])
     return ""
Ejemplo n.º 7
0
def show_more(context, label=None, loading=settings.LOADING):
    """
    Show the link to get the next page in a Twitter-like pagination.
    Usage::

        {% show_more %}

    Alternatively you can override the label passed to the
    default template::

        {% show_more "even more" %}

    You can override the loading text too::

        {% show_more "even more" "working" %}

    Must be called after {% paginate objects %}.
    """
    # this can raise a PaginationError
    # (you have to call paginate before including the show more template)
    page = utils.get_page_from_context(context)
    # show the template only if there is a next page
    if page.has_next():
        request = context["request"]
        page_number = page.next_page_number()
        # querystring
        querystring_key = context["endless_querystring_key"]
        querystring = utils.get_querystring_for_page(
            request,
            page_number,
            querystring_key,
            default_number=context["endless_default_number"])
        return {
            'path': context["endless_override_path"] or request.path,
            'querystring_key': querystring_key,
            'querystring': querystring,
            'loading': loading,
            'label': label,
            'request': request,
        }
    # no next page, nothing to see
    return {}
Ejemplo n.º 8
0
def show_more_table(context, label=None, loading=endless_settings.LOADING):
    # this can raise a PaginationError 
    # (you have to call paginate before including the show more template)
    page = utils.get_page_from_context(context)
    # show the template only if there is a next page
    if page.has_next():
        request = context["request"]
        page_number = page.next_page_number()
        # querystring
        querystring_key = context["endless_querystring_key"]
        querystring = utils.get_querystring_for_page(request, page_number,
            querystring_key, default_number=context["endless_default_number"])
        return {
            'path': context["endless_override_path"] or request.path,
            'querystring_key': querystring_key,
            'querystring': querystring,
            'loading': loading,
            'label': label,
            'request': request,
        }
    # no next page, nothing to see
    return {}