Package: django-bootstrap-pagination-vinta
===========================Django Bootstrap Pagination===========================**Note:** This version is compatible with Bootstrap 3.x only! Please use the 1.0.x branch for Bootstrap 2 support.This application serves to make using Twitter's Bootstrap Pagination styleswork seamlessly with Django Page objects. By passing in a Page object andone or more optional arguments, Bootstrap pagination bars and pagers canbe rendered with very little effort.Compatible with Django 1.3+.. contents ::------------Installation------------**PIP**pip install django-bootstrap-pagination**Download**Download the latest stable distribution from:http://pypi.python.org/pypi/django-bootstrap-paginationDownload the latest development version from:github @ http://www.github.com/jmcclell/django-bootstrap-paginationsetup.py install-----Usage-----**Setup**Make sure you include bootstrap-pagination in your installed_apps list in settings.py:INSTALLED_APPS = ('bootstrap_pagination',)Additionally, include the following snippet at the top of any template that makes use ofthe pagination tags:{% load bootstrap_pagination %}==================bootstrap_paginate==================Takes a `Django Paginator instance <https://docs.djangoproject.com/en/dev/topics/pagination/>`_as an argument to build a jump to page element.**All Optional Arguments**rangeDefines the maximum number of page links to showshow_prev_nextBoolean. Defines whether or not to show the Previous and Next links. (Accepts "true" or "false")previous_labelThe label to use for the Previous linknext_labelThe label to use for the Next linkshow_first_lastBoolean. Defines whether or not to show the First and Last links. (Accepts "true" or "false")first_labelThe label to use for the First page linklast_labelThe label to use for the Last page linkurl_view_nameA named URL reference (such as one that might get passed inti the URL template tag) to use asthe URL template. Must be resolvable by the reverse() function. **If this option is notspecified, the tag simply uses a relative url such as "?page=1" which is fine in mostsituations**url_param_nameDetermines the name of the GET parameter for the page number. The default is "page". If no**url_view_name** is defined, this string is appended to the url as "?{{url_param_name}}=1".url_extra_args**Only valid when url_view_name is set.**Additional arguments to pass into reverse() to resolve the URL.url_extra_kwargs**Only valid when url_view_name is set.**Additional named arguments to pass into reverse() to resolve the URL. Additionally,thetemplate tag will add an extra parameter to this for the page, as it is assumed that ifgiven a url_name, the page will be a named variable in the URL regular expression. Inthis case, the **url_param_name** continues to be the string used to represent the name.That is, by default, **url_param_name** is equal to "page" and thus it is expected thatthere is a named "page" argument in the URL referenced by **url_view_name**. This allowsus to use pretty pagination URLs such as "/page/1"**Basic Usage**The following will show a pagination bar with a link to every page, a previous link, and a next link:{% bootstrap_paginate page_obj %}The following will show a pagination bar with at most 10 page links, a previous link, and a next link:{% bootstrap_paginate page_obj range=10 %}The following will show a pagination bar with at most 10 page links, a first page link, and a last page link:{% bootstrap_paginate page_obj range=10 show_prev_next="false" show_first_last="true" %}**Advanced Usage**Given a url configured such as:archive_index_view = ArchiveIndexView.as_view(date_field='date',paginate_by=10,allow_empty=True,queryset=MyModel.all(),template_name='example/archive.html')urlpatterns = patterns('example.views',url(r'^$', archive_index_view, name='archive_index'),url(r'^page/(?P<page>\d+)/$', archive_index_view,name='archive_index_paginated'))We could simply use the basic usage (appending ?page=#) with the *archive_index* URL above,as the *archive_index_view* class based generic view from django doesn't care how it getsthe page parameter. However, if we want pretty URLs, such as those defined in the*archive_index_paginated* URL (ie: /page/1), we need to define the URL in our template tag:{% bootstrap_paginate page_obj url_view_name="archive_index_paginated" %}Because we are using a default page parameter name of "page" and our URL requires no otherparameters, everything works as expected. If our URL required additional parameters, wewould pass them in using the optional arguments **url_extra_args** and **url_extra_kwargs**.Likewise, if our page parameter had a different name, we would pass in a different**url_param_name** argument to the template tag.===============bootstrap_pager===============A much simpler implementation of the Bootstrap Pagination functionality is the Pager, whichsimply provides a Previous and Next link.**All Optional Arguments**previous_labelDefines the label for the Previous linknext_labelDefines the label for the Next linkprevious_titleDefines the link title for the previous linknext_titleDefines the link title for the next linkcenteredBoolean. Defines whether or not the links are centered. Defaults to false.(Accepts "true" or "false")url_view_nameA named URL reference (such as one that might get passed inti the URL template tag) to use asthe URL template. Must be resolvable by the reverse() function. **If this option is notspecified, the tag simply uses a relative url such as "?page=1" which is fine in mostsituations**url_param_nameDetermines the name of the GET parameter for the page number. The default is "page". If no**url_view_name** is defined, this string is appended to the url as "?{{url_param_name}}=1".url_extra_args**Only valid when url_view_name is set.**Additional arguments to pass into reverse() to resolve the URL.url_extra_kwargs**Only valid when url_view_name is set.**Additional named arguments to pass into reverse() to resolve the URL. Additionally,thetemplate tag will add an extra parameter to this for the page, as it is assumed that ifgiven a url_name, the page will be a named variable in the URL regular expression. Inthis case, the **url_param_name** continues to be the string used to represent the name.That is, by default, **url_param_name** is equal to "page" and thus it is expected thatthere is a named "page" argument in the URL referenced by **url_view_name**. This allowsus to use pretty pagination URLs such as "/page/1"url_anchorThe anchor to use in URLs. Defaults to None.**Usage**Usage is basically the same as for bootstrap_paginate. The simplest usage is:{% bootstrap_pager page_obj %}A somewhat more advanced usage might look like:{% bootstrap_pager page_obj previous_label="Newer Posts" next_label="Older Posts" url_view_name="post_archive_paginated" %}