Opened 5 years ago

Closed 5 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: UI/UX:

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 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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