#34286 closed Bug (fixed)
Mixed-case views/templates names causes 404 on :view:/:template: directive.
Reported by: | Alex Life | Owned by: | Rahmat Faisal |
---|---|---|---|
Component: | contrib.admindocs | Version: | 4.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
https://github.com/django/django/blob/main/django/contrib/admindocs/views.py#L168
Using a class based view,
class OrderSearch(LoginRequiredMixin, UserPassesTestMixin, ListView):
add a doc comment such as
:view:orders.views.Orders
causes a 404 when you click on the link in the docs
Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/admin/doc/views/orders.views.orders/
Raised by: django.contrib.admindocs.views.ViewDetailView
I'm not sure exactly where orders becomes lowercase, but I thought it might have something to do with the _get_view_func
Change History (11)
comment:1 by , 22 months ago
Summary: | Class based views cause 404 on admindocs.views.ViewDetailView → Class based views cause 404 on :view: directive. |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 22 months ago
Replying to Rahmat Faisal:
gonna look
Yeah if u have views for example
class About(Views): ...
and in the docs you write
:view:`app_label.views.About`
and if u acces, and the url gonna change to localhost:8000/admin/docs/app_label.views.about
and return 404. the url should be localhost:8000/admin/docs/app_label.views.About
comment:4 by , 22 months ago
the problem from admindocs utils function https://github.com/django/django/blob/main/django/contrib/admindocs/utils.py#L59, that makes convert into lowercase
comment:5 by , 22 months ago
Has patch: | set |
---|
patch this PR https://github.com/django/django/pull/16517
comment:6 by , 22 months ago
Needs tests: | set |
---|
comment:8 by , 22 months ago
Patch needs improvement: | set |
---|---|
Summary: | Class based views cause 404 on :view: directive. → Mixed-case views/templates names causes 404 on :view:/:template: directive. |
comment:9 by , 22 months ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
Triage Stage: | Accepted → Ready for checkin |
Thanks for the ticket. It was originally reported in the #27409 among other issues
but I think it deserves a separate ticket.