[Django] #33233: Handle 404 Not Found Error when invalid page num comes is given to ListView

76 views
Skip to first unread message

Django

unread,
Oct 28, 2021, 10:47:17 AM10/28/21
to django-...@googlegroups.com
#33233: Handle 404 Not Found Error when invalid page num comes is given to ListView
-------------------------------------+-------------------------------------
Reporter: DongGeon | Owner: nobody
Lee |
Type: New | Status: assigned
feature |
Component: Generic | Version: 4.0
views | Keywords: ListView,
Severity: Normal | Paginator, Pagination
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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.py` or `validate_number()` in
`django.core.paginator.py`.

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.)

--
Ticket URL: <https://code.djangoproject.com/ticket/33233>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 28, 2021, 10:47:40 AM10/28/21
to django-...@googlegroups.com
#33233: Handle 404 Not Found Error when invalid page num comes is given to ListView
-------------------------------------+-------------------------------------
Reporter: DongGeon Lee | Owner: DongGeon
| Lee
Type: New feature | Status: assigned
Component: Generic views | Version: 4.0
Severity: Normal | Resolution:
Keywords: ListView, | Triage Stage:
Paginator, Pagination | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by DongGeon Lee):

* cc: DongGeon Lee (added)
* owner: nobody => DongGeon Lee


--
Ticket URL: <https://code.djangoproject.com/ticket/33233#comment:1>

Django

unread,
Oct 28, 2021, 10:49:02 AM10/28/21
to django-...@googlegroups.com
#33233: Handle 404 Not Found Error when page number is out of page range

-------------------------------------+-------------------------------------
Reporter: DongGeon Lee | Owner: DongGeon
| Lee
Type: New feature | Status: assigned
Component: Generic views | Version: 4.0
Severity: Normal | Resolution:
Keywords: ListView, | Triage Stage:
Paginator, Pagination | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/33233#comment:2>

Django

unread,
Oct 28, 2021, 10:51:16 AM10/28/21
to django-...@googlegroups.com
#33233: Handle 404 Not Found Error when page number is out of page range
-------------------------------------+-------------------------------------
Reporter: DongGeon Lee | Owner: DongGeon
| Lee
Type: New feature | Status: assigned
Component: Generic views | Version: 4.0
Severity: Normal | Resolution:
Keywords: ListView, | Triage Stage:
Paginator, Pagination | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by DongGeon Lee:

Old description:

> 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.py` or `validate_number()` in
> `django.core.paginator.py`.
>
> 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.)

New description:

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.)

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33233#comment:3>

Django

unread,
Oct 28, 2021, 11:37:02 AM10/28/21
to django-...@googlegroups.com
#33233: Handle 404 Not Found Error when page number is out of page range
-------------------------------------+-------------------------------------
Reporter: DongGeon Lee | Owner: DongGeon
| Lee
Type: New feature | Status: closed

Component: Generic views | Version: 4.0
Severity: Normal | Resolution: duplicate

Keywords: ListView, | Triage Stage:
Paginator, Pagination | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: assigned => closed
* has_patch: 1 => 0
* resolution: => duplicate


Comment:

Duplicate of #9798.

--
Ticket URL: <https://code.djangoproject.com/ticket/33233#comment:4>

Reply all
Reply to author
Forward
0 new messages