Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#110 closed enhancement (fixed)

Documentation on pagination needed

Reported by: maurycy Owned by: Jacob
Component: Documentation Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Third path of tutorial should show views that don't return output and polls list with paging support.

Change History (4)

comment:1 Changed 15 years ago by anonymous

Summary: Third path of tutorial suggestionsTutorial suggestions

comment:2 Changed 15 years ago by Jacob

Severity: normalenhancement
Status: newassigned
Summary: Tutorial suggestionsDocumentation on pagination needed

Views that don't return output are documented in a few places -- see anywhere that uses HttpResponseRedirect; changing this ticket to reflect that pagination needs documentation

comment:3 Changed 15 years ago by maurycy

BTW. django.views.generic.list_details.object_list seems to be a good example of pagination:

def object_list(request, app_label, module_name, paginate_by=None, allow_empty=False, template_name=None, extra_lookup_kwargs={}, extra_context=None):
    mod = models.get_module(app_label, module_name)
    lookup_kwargs = extra_lookup_kwargs.copy()
    if paginate_by:
        paginator = ObjectPaginator(mod, lookup_kwargs, paginate_by)
        page = request.GET.get('page', 0)
            object_list = paginator.get_page(page)
        except InvalidPage:
            raise Http404
        page = int(page)
        c = Context(request, {
            'object_list': object_list,
            'is_paginated' : True,
            'results_per_page' : paginate_by,
            'has_next': paginator.has_next_page(page),
            'has_previous': paginator.has_previous_page(page),
            'page': page + 1,
            'next': page + 1,
            'previous': page - 1,
            'pages': paginator.pages,
        object_list = mod.get_list(**lookup_kwargs)
        c = Context(request, {
            'object_list' : object_list,
            'is_paginated' : False

comment:4 Changed 15 years ago by maurycy

Resolution: fixed
Status: assignedclosed

We can assume that documentation of generic views describes pagination well.

Note: See TracTickets for help on using tickets.
Back to Top