Opened 3 years ago

Closed 3 years ago

#33233 closed New feature (duplicate)

Handle 404 Not Found Error when page number is out of page range

Reported by: DongGeon Lee Owned by: DongGeon Lee
Component: Generic views Version: 4.0
Severity: Normal Keywords: ListView, Paginator, Pagination
Cc: DongGeon Lee 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 DongGeon Lee)

There is pagination in ListView and it show 404 error when page number is out of page range.
It is reasonable but I think the options to control 404 exception always should be there.
In current Implementation, if users want to handle 404 exception(Http404), they have to override whole get_queryset() in django.view.generic.list.MultipleObjectMixin or validate_number() in django.core.paginator.Paginator.

So I suggest the flag allow_out_of_range: bool in MultipleObjectMixin class to on/off 404 exception.
(I already have a pull request ready to go.)

Change History (4)

comment:1 by DongGeon Lee, 3 years ago

Cc: DongGeon Lee added
Owner: changed from nobody to DongGeon Lee

comment:2 by DongGeon Lee, 3 years ago

Summary: Handle 404 Not Found Error when invalid page num comes is given to ListViewHandle 404 Not Found Error when page number is out of page range

comment:3 by DongGeon Lee, 3 years ago

Description: modified (diff)

comment:4 by Mariusz Felisiak, 3 years ago

Has patch: unset
Resolution: duplicate
Status: assignedclosed

Duplicate of #9798.

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