Opened 19 years ago

Closed 19 years ago

Last modified 18 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

Description

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

Change History (4)

comment:1 by anonymous, 19 years ago

Summary: Third path of tutorial suggestionsTutorial suggestions

comment:2 by Jacob, 19 years ago

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 by maurycy, 19 years ago

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)
        try:
            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,
        })
    else:
        object_list = mod.get_list(**lookup_kwargs)
        c = Context(request, {
            'object_list' : object_list,
            'is_paginated' : False
        })

comment:4 by maurycy, 19 years ago

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