mdn/django-locallibrary-tutorial

raise NoReverseMatch(msg) django.urls.exceptions.NoReverseMatch: Reverse for 'renew-book-librarian' with arguments '(UUID('b3efb948-ab15-44dc-87af-50c6ede58c18'),)' not found. 1 pattern(s) tried: ['catalog/book/uuid:pk>/renew/$']

philipokiokio opened this issue · 2 comments

Good day and thank you for the material provided for learning. I followed tutorial 9 about forms everything worked fine till I clicked the link to be taken to the form area that was when I got a

` raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'renew-book-librarian' with arguments '(UUID('b3efb948-ab15-44dc-87af-50c6ede58c18'),)' not found. 1 pattern(s) tried: ['catalog/book/uuid:pk>/renew/$']
'

I have tried solving it for about a day now and I have been unable to solve it.

what this almost certainly means is that you have forgotten to add a name field in your URL mappings, so that it can be reversed. See this line:

# Add URLConf for librarian to renew a book.
urlpatterns += [
    path('book/<uuid:pk>/renew/', views.renew_book_librarian, name='renew-book-librarian'),
]

Closing because tis is the likely source of the problem.

Thank you, but that was not it, ironically I can't remember what I did but I have resolved it thank you.