Fixed #14900 -- Added ability to override the paginator class used in a ModelAdmin. Thanks, Adam Vandenberg.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2010-12-21 14:57:29 +00:00
parent 7655cd8eac
commit 98e1a71ceb
4 changed files with 69 additions and 8 deletions

View file

@ -516,6 +516,16 @@ subclass::
Django will only honor the first element in the list/tuple; any others
will be ignored.
.. attribute:: ModelAdmin.paginator
.. versionadded:: 1.3
The paginator class to be used for pagination. By default,
:class:`django.core.paginator.Paginator` is used. If the custom paginator
class doesn't have the same constructor interface as
:class:`django.core.paginator.Paginator`, you will also need to
provide an implementation for :meth:`MultipleObjectMixin.get_paginator`.
.. attribute:: ModelAdmin.prepopulated_fields
Set ``prepopulated_fields`` to a dictionary mapping field names to the
@ -945,6 +955,13 @@ templates used by the :class:`ModelAdmin` views:
using the :mod:`django.contrib.messages` backend. See the
:ref:`custom ModelAdmin example <custom-admin-action>`.
.. method:: ModelAdmin.get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True)
.. versionadded:: 1.3
Returns an instance of the paginator to use for this view. By default,
instantiates an instance of :attr:`paginator`.
Other methods
~~~~~~~~~~~~~