#36174: Add "Show All" option when pagination is applied on the admin history
page.
----------------------------+-----------------------------------------
Reporter: Antoliny | Type: New feature
Status: new | Component: contrib.admin
Version: 5.1 | Severity: Normal
Keywords: pagination | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+-----------------------------------------
In the admin change list page, pagination can be optionally applied
through the `list_per_page` option of `ModelAdmin`.
{{{
class PostAdmin(admin.ModelAdmin):
list_display = ["title"]
list_per_page = 3
admin.site.register(Post, PostAdmin)
}}}
[[Image(change_list_pagination.png)]]
As shown in the image above, pagination related elements are rendered.
Among them, a "Show all" button is provided, which allows users to view
all objects when clicked.
In the admin History page, pagination is also applied automatically (not
optionally) when the number of items exceeds 100, but the "Show all"
option is not provided.
[[Image(history_view_pagination.png)]]
Since pagination is automatically applied in history_view, I believe
history_view also needs a "Show all" button.
=== Additionally ===
I looked into why there are differences between the pagination applied in
the history_view and the change_list. When the history_view was first
implemented, this aspect was naturally considered, but I found that the
pagination related template tags(pagination, pagination_number) only work
with `ChangeList`.
{{{
def pagination(cl):
"""
Generate the series of links to the pages in a paginated list.
"""
pagination_required = (not cl.show_all or not cl.can_show_all) and
cl.multi_page
page_range = cl.paginator.get_elided_page_range(cl.page_num) if
pagination_required else []
need_show_all_link = cl.can_show_all and not cl.show_all and
cl.multi_page
return {
'cl': cl,
'pagination_required': pagination_required,
'show_all_url': need_show_all_link and
cl.get_query_string({ALL_VAR: ''}),
'page_range': page_range,
'ALL_VAR': ALL_VAR,
'1': 1,
}
}}}
I strongly feel that this issue should be resolved so that pagination is
applied consistently across the Admin pages.
(I will create a separate issue regarding this matter.)
--
Ticket URL: <https://code.djangoproject.com/ticket/36174>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070194e36b9c76-f580c2f4-e3f3-41f5-813e-4306007d68c0-000000%40eu-central-1.amazonses.com.