[Django] #35345: Bug in Tutorial 3 of Documentation

6 views
Skip to first unread message

Django

unread,
Mar 31, 2024, 10:03:46 AM3/31/24
to django-...@googlegroups.com
#35345: Bug in Tutorial 3 of Documentation
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
nimakarimiank |
Type: Bug | Status: new
Component: | Version: 5.0
Documentation | Keywords: Template,URL
Severity: Normal | conf,Views
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
### Bug in Tutorial part 3 of the Documentation
referencing from Tutorial part 1:
since we have created a new polls app in out mysite project we configured
the mysite.url like this
```
urlpatterns = [
path("polls/", include("polls.urls")),
path("admin/", admin.site.urls),
]
```
so when we render the page polls/index.html or namely, the index view in
our poll app the base url would be localhost/polls/
and with having this in our template : `<li><a
href="/polls/{{question.id}}/">`
the GENERATED link would be : localhost/polls/polls/question_id **which
raises an error** since we didn't describe such pattern in our urls.py
file in polls app
```
urlpatterns = [
path("",view=views.index,name="index"),
path("<int:question_id>/",view=views.detail,name="detail"),
path("<int:question_id>/results/",view=views.results,name="results"),
path("<int:question_id>/vote/",view=views.vote,name="vote"),
]
```
--
Ticket URL: <https://code.djangoproject.com/ticket/35345>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 31, 2024, 10:11:12 AM3/31/24
to django-...@googlegroups.com
#35345: Bug in Tutorial 3 of Documentation
-------------------------------------+-------------------------------------
Reporter: nimakarimiank | Owner:
| nimakarimiank
Type: Bug | Status: assigned
Component: Documentation | Version: 5.0
Severity: Normal | Resolution:
Keywords: Template,URL | Triage Stage:
conf,Views | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nimakarimiank):

* has_patch: 0 => 1
* owner: nobody => nimakarimiank
* status: new => assigned

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

Django

unread,
Mar 31, 2024, 2:03:33 PM3/31/24
to django-...@googlegroups.com
#35345: Bug in Tutorial 3 of Documentation
-------------------------------------+-------------------------------------
Reporter: nima karimian | Owner: nima
| karimian
Type: Bug | Status: closed
Component: Documentation | Version: 5.0
Severity: Normal | Resolution: invalid
Keywords: Template,URL | Triage Stage:
conf,Views | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* resolution: => invalid
* status: assigned => closed


Old description:

> ### Bug in Tutorial part 3 of the Documentation
> referencing from Tutorial part 1:
> since we have created a new polls app in out mysite project we configured
> the mysite.url like this
> ```
> urlpatterns = [
> path("polls/", include("polls.urls")),
> path("admin/", admin.site.urls),
> ]
> ```
> so when we render the page polls/index.html or namely, the index view in
> our poll app the base url would be localhost/polls/
> and with having this in our template : `<li><a
> href="/polls/{{question.id}}/">`
> the GENERATED link would be : localhost/polls/polls/question_id **which
> raises an error** since we didn't describe such pattern in our urls.py
> file in polls app
> ```
> urlpatterns = [
> path("",view=views.index,name="index"),
> path("<int:question_id>/",view=views.detail,name="detail"),
> path("<int:question_id>/results/",view=views.results,name="results"),
> path("<int:question_id>/vote/",view=views.vote,name="vote"),
> ]
> ```

New description:

### Bug in Tutorial part 3 of the Documentation
referencing from Tutorial part 1:
since we have created a new polls app in out mysite project we configured
the mysite.url like this
{{{
urlpatterns = [
path("polls/", include("polls.urls")),
path("admin/", admin.site.urls),
]
}}}
so when we render the page polls/index.html or namely, the index view in
our poll app the base url would be localhost/polls/
and with having this in our template : `<li><a
href="/polls/{{question.id}}/">`
the GENERATED link would be : localhost/polls/polls/question_id **which
raises an error** since we didn't describe such pattern in our urls.py
file in polls app
{{{
urlpatterns = [
path("",view=views.index,name="index"),
path("<int:question_id>/",view=views.detail,name="detail"),
path("<int:question_id>/results/",view=views.results,name="results"),
path("<int:question_id>/vote/",view=views.vote,name="vote"),
]
}}}

--
Comment:

If the link went to `/polls/polls/question_id`, I think you may have put
`<a href="polls/{{question.id}}/">` (without a slash before polls) in your
template.
--
Ticket URL: <https://code.djangoproject.com/ticket/35345#comment:2>
Reply all
Reply to author
Forward
0 new messages