Ticket #2367: django_pagination.diff

File django_pagination.diff, 10.1 KB (added by Tyler <tyler@…>, 7 years ago)

The previous patch uses the deprecated ObjectPaginator class and changes paginator.py. This patch changes only date_based.py and uses the newer interface as defined in list_detail.py's object_list method.

  • django/views/generic/date_based.py

    a b from django.core.exceptions import ObjectDoesNotExist 
    66from django.core.xheaders import populate_xheaders
    77from django.db.models.fields import DateTimeField
    88from django.http import Http404, HttpResponse
     9from django.core.paginator import QuerySetPaginator, InvalidPage
    1011def archive_index(request, queryset, date_field, num_latest=15,
    1112        template_name=None, template_loader=loader,
    1213        extra_context=None, allow_empty=True, context_processors=None,
    13         mimetype=None, allow_future=False, template_object_name='latest'):
     14        mimetype=None, allow_future=False, template_object_name='latest',
     15        paginate_by=None, page=None):
    1416    """
    1517    Generic top-level archive of date-based objects.
    def archive_index(request, queryset, date_field, num_latest=15, 
    2022            List of years
    2123        latest
    2224            Latest N (defaults to 15) objects by date
     25        paginator
     26            paginator object
     27        page_obj
     28            page object
    2329    """
    2430    if extra_context is None: extra_context = {}
    2531    model = queryset.model
Back to Top