[Answered ]-Why am I obtaining "NoReverseMatch at /catalog/borrowed/" error in this Django application?

1👍

The mistake probably is in the reverse HttpResponseRedirect in the views.py of the renew_book_librarian() method.

For the argument that’s passed to reverse('name') pass the correct ‘name‘, from where the function is originally called.

👤m_j_e

0👍

catalog.urls is something you call from locallibrary.urls(which has the root urls).

In this case you need to give a app name for the urls in catalog.urls.

eg:
app_name = 'catalog'

All the urls inside the catalog.urls needs to be called in the template by it’s app name.

eg:
{% url 'catalog:book-detail' bookinst.book.pk %}

When you are just calling book-detail without it’s app name, then django starts looking at the root urls file where this particular url doesn’t exist.

👤Lag11

Leave a comment