Opened 13 hours ago

Last modified 12 hours ago

#36174 assigned New feature

Apply optional pagination to history_view. — at Version 2

Reported by: Antoliny Owned by: Antoliny
Component: contrib.admin Version: 5.1
Severity: Normal Keywords: pagination
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Antoliny)

Currently, pagination in history_view is applied automatically (when EntryObjects exceed 100).

    def history_view(...):
        paginator = self.get_paginator(request, action_list, 100)
        page_number = request.GET.get(PAGE_VAR, 1)
        page_obj = paginator.get_page(page_number)
        page_range = paginator.get_elided_page_range(page_obj.number)

        context = {
            **self.admin_site.each_context(request),
            "title": _("Change history: %s") % obj,
            "subtitle": None,
            "action_list": page_obj,
            "page_range": page_range,
            "page_var": PAGE_VAR,
            "pagination_required": paginator.count > 100,

As shown in the code above, the pagination value(100) is static, and I would like it to be optionally provided, similar to how pagination is applied in list_display.

class PostAdmin(admin.ModelAdmin):
    list_display = ["title"]
    list_per_page = 3
    example) list_per_history = xx 

Moreover, since the "Show all" button available in list_display is not provided in history_view, this need feels even more necessary.
(Even if the "Show all" button is not provided, I believe this functionality is still necessary. It is especially useful when searching for a specific object using text(Ex.. Mac Command + F) search or similar features when pagination is not applied.)

Change History (3)

by Antoliny, 13 hours ago

Attachment: history_view_pagination.png added

comment:1 by Antoliny, 13 hours ago

Owner: set to Antoliny
Status: newassigned

comment:2 by Antoliny, 12 hours ago

Description: modified (diff)
Summary: Add "Show All" option when pagination is applied on the admin history page.Apply optional pagination to history_view.
Note: See TracTickets for help on using tickets.
Back to Top