Skip to content

Commit

Permalink
Default endpoint to request.endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbr committed Nov 5, 2014
1 parent 922b12a commit 9c475ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docs/basic-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ automatically rendered through the ``render_pagination`` macro::
{{render_pagination(query_results)}}

.. py:function:: render_pagination(pagination,\
endpoint,\
endpoint=None,\
prev='«',\
next='»',\
ellipses='',\
Expand All @@ -193,7 +193,8 @@ automatically rendered through the ``render_pagination`` macro::
:param pagination: :class:`~flask.ext.sqlalchemy.Pagination` instance.
:param endpoint: Which endpoint to call when a page number is clicked.
:func:`~flask.url_for` will be called with the given
endpoint and a single parameter, ``page``.
endpoint and a single parameter, ``page``. If ``None``,
uses the requests current endpoint.
:param prev: Symbol/text to use for the "previous page" button. If
``None``, the button will be hidden.
:param next: Symbol/text to use for the "previous next" button. If
Expand Down
4 changes: 3 additions & 1 deletion flask_bootstrap/templates/bootstrap/pagination.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{% macro render_pagination(pagination,
endpoint,
endpoint=None,
prev=('«')|safe,
next=('»')|safe,
ellipses='…')
-%}
{% with endpoint = endpoint or request.endpoint %}
<nav>
<ul class="pagination"{{kwargs|xmlattr}}>
{# prev and next are only show if a symbol has been passed. #}
Expand All @@ -28,4 +29,5 @@
{%- endif -%}
</ul>
</nav>
{% endwith %}
{% endmacro %}

0 comments on commit 9c475ab

Please sign in to comment.