Opened 14 years ago

Closed 14 years ago

#15128 closed (wontfix)

Generic view paginator: read paginate_by from GET

Reported by: themax.ru@… Owned by: nobody
Component: Generic views Version: 1.2
Severity: Keywords: generic view paginator
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Just a sample:

    paginate_by = int( request.GET.get('paginate_by', paginate_by) )
    if extra_context is None: extra_context = {}
    queryset = queryset._clone()
    if paginate_by:
        paginator = Paginator(queryset, paginate_by, allow_empty_first_page=allow_empty)
        if not page:
...

This will allow to change "paginate_by" parameter on the fly on the same manner as "page".

Change History (1)

comment:1 by Russell Keith-Magee, 14 years ago

Resolution: wontfix
Status: newclosed

I'm not convinced this is something important enough that it should be baked into the core API.

The current page is indisputably an issue of access -- I need the third page of results. Choosing 10 items per page rather than 15 or 100 is a matter of design, and shouldn't be (by default) exposed to the end-user.

If you want to enable this functionality, you can implement a get_paginate_by() method that calls on self.request.GET.get('paginate_by). That means that what you describe is possible, just not baked in by default.

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