M docs/install.txt => docs/install.txt +25 -4
@@ 1,5 1,5 @@
-Installing django-pagination
-----------------------------
+Installing the latest development version of django-pagination
+---------------------------------------------------------------
To install, first check out the latest version of the application from
subversion:
@@ 15,5 15,26 @@ do the trick for you:
sudo ln -s `pwd`/pagination `python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`/pagination
-Now it's installed. Please see README.txt for information on how to use this
-application in your projects.>
\ No newline at end of file
+Now it's installed! Please see usage.txt for information on how to use this
+application in your projects.
+
+Installing via setup.py
+-----------------------
+
+Included with this application is a file named ``setup.py``. It's possible to
+use this file to install this application to your system, by invoking the
+following command:
+
+ sudo python setup.py install
+
+Once that's done, you should be able to begin using django-pagination at will.
+
+Installing via setuptools
+-------------------------
+
+If you have setuptools_ installed, you can simply run the following command
+to install django-pagination:
+
+ sudo easy_install django-pagination
+
+.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools<
\ No newline at end of file
M docs/usage.txt => docs/usage.txt +26 -0
@@ 68,3 68,29 @@ installation, which is covered in INSTALL.txt in this same directory.)
That's it! You have now paginated ``object_list`` and given users of the site
a way to navigate between the different pages--all without touching your views.
+
+
+Optional Settings
+------------------
+
+In django-pagination, there are no required settings. There are, however, a
+small set of optional settings useful for changing the default behavior of the
+pagination tags. Here's an overview:
+
+``PAGINATION_DEFAULT_PAGINATION``
+ The default amount of items to show on a page if no number is specified.
+
+``PAGINATION_DEFAULT_WINDOW``
+ The number of items to the left and to the right of the current page to
+ display (accounting for ellipses).
+
+``PAGINATION_DEFAULT_ORPHANS``
+ The number of orphans allowed. According to the Django documentation,
+ orphans are defined as::
+
+ The minimum number of items allowed on the last page, defaults to zero.
+
+``PAGINATION_INVALID_PAGE_RAISES_404``
+ Determines whether an invalid page raises an ``Http404`` or just sets the
+ ``invalid_page`` context variable. ``True`` does the former and ``False``
+ does the latter.<
\ No newline at end of file
M => +7 -0
@@ 2,7 2,9 @@ try:
set
except NameError:
from sets import Set as set
from django import template
from django.http import Http404
from django.core.paginator import Paginator, InvalidPage
from django.conf import settings
@@ 11,6 13,8 @@ register = template.Library()
DEFAULT_PAGINATION = getattr(settings, 'PAGINATION_DEFAULT_PAGINATION', 20)
DEFAULT_WINDOW = getattr(settings, 'PAGINATION_DEFAULT_WINDOW', 4)
DEFAULT_ORPHANS = getattr(settings, 'PAGINATION_DEFAULT_ORPHANS', 0)
INVALID_PAGE_RAISES_404 = getattr(settings, 'PAGINATION_INVALID_PAGE_RAISES_404',
False)
def do_autopaginate(parser, token):
"""
@@ 85,6 89,9 @@ class AutoPaginateNode(template.Node):
try:
page_obj = paginator.page(context['request'].page)
except InvalidPage:
if INVALID_PAGE_RAISES_404:
raise Http404('Invalid page requested. If DEBUG were set to ' +
'False, an HTTP 404 page would have been shown instead.')
context[key] = []
context['invalid_page'] = True
return u''
M setup.py => setup.py +27 -1
@@ 1,6 1,6 @@
from setuptools import setup, find_packages
-version = '1.0.4'
+version = '1.0.5'
LONG_DESCRIPTION = """
How to use django-pagination
@@ 73,6 73,32 @@ installation, which is covered in INSTALL.txt in this same directory.)
That's it! You have now paginated ``object_list`` and given users of the site
a way to navigate between the different pages--all without touching your views.
+
+
+Optional Settings
+------------------
+
+In django-pagination, there are no required settings. There are, however, a
+small set of optional settings useful for changing the default behavior of the
+pagination tags. Here's an overview:
+
+``PAGINATION_DEFAULT_PAGINATION``
+ The default amount of items to show on a page if no number is specified.
+
+``PAGINATION_DEFAULT_WINDOW``
+ The number of items to the left and to the right of the current page to
+ display (accounting for ellipses).
+
+``PAGINATION_DEFAULT_ORPHANS``
+ The number of orphans allowed. According to the Django documentation,
+ orphans are defined as::
+
+ The minimum number of items allowed on the last page, defaults to zero.
+
+``PAGINATION_INVALID_PAGE_RAISES_404``
+ Determines whether an invalid page raises an ``Http404`` or just sets the
+ ``invalid_page`` context variable. ``True`` does the former and ``False``
+ does the latter.
"""
setup(