Jonathan Kleiman
Jonathan Kleiman

Reputation: 11

404 Error with Django URL even though it is included in url patterns

Here's the error I'm getting:

Page not found (404)
Request Method: GET
Request URL:    http://localhost:8000/bet/4/update
Using the URLconf defined in chessbet.urls, Django tried these URL patterns, in this order:
admin/[name='bet-home']
bet/<int:pk> [name='bet-detail']
bet/<int:pk>/update/> [name='bet-update']
about/ [name='bet-about']
bet/new/ [name='bet-create']
register/ [name='register']
login/ [name='login']
logout/ [name='logout']
yourprofile/ [name='yourprofile']

^media/(?P<path>.*)$

The current path, bet/4/update, didn't match any of these.

Now from what I see the current path is equivalent to the path I laid out for bet-update. What am I doing wrong here?

Here is my urls.py:

urlpatterns = [
    path('', BetListView.as_view(), name = "bet-home"),
    path("bet/<int:pk>", BetDetailView.as_view(), name="bet-detail"),
    path("bet/<int:pk>/update/>", BetUpdateView.as_view(), name="bet-update"),
    path('about/', views.about, name = "bet-about"),
    path("bet/new/", BetCreateView.as_view(), name="bet-create") 
]

Bet detail which does something very similar works fine but bet update does not.

Any help would be much appreciated.

Upvotes: 0

Views: 125

Answers (1)

Anton Pomieshchenko
Anton Pomieshchenko

Reputation: 2167

It seems that you have odd /> in update path should be

    path("bet/<int:pk>/update", BetUpdateView.as_view(), name="bet-update"),

Upvotes: 2

Related Questions