Changes between Initial Version and Version 2 of Ticket #35345


Ignore:
Timestamp:
Mar 31, 2024, 1:03:26 PM (5 months ago)
Author:
Tim Graham
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.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35345

    • Property Has patch set
    • Property Owner changed from nobody to nima karimian
    • Property Status newclosed
    • Property Resolutioninvalid
  • Ticket #35345 – Description

    initial v2  
    22referencing from Tutorial part 1:
    33since we have created a new polls app in out mysite project we configured the mysite.url like this 
    4 ```
     4{{{
    55urlpatterns = [
    66    path("polls/", include("polls.urls")),
    77    path("admin/", admin.site.urls),
    88]
    9 ```
     9}}}
    1010so when we render the page polls/index.html or namely, the index view in our poll app the base url would be localhost/polls/
    1111and with having this in our template : `<li><a href="/polls/{{question.id}}/">`
    1212the 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
    13 ```
     13{{{
    1414urlpatterns = [
    1515    path("",view=views.index,name="index"),
     
    1818    path("<int:question_id>/vote/",view=views.vote,name="vote"),
    1919]
    20 ```
    21 
     20}}}
Back to Top