I am trying to set up links inside a tags, and when I do this procedure as seen in the code, it gives me the error:
TypeError at / 'str' object is not a mapping
It use to work fine but then decided not to
template code:
<a class="item" href="{% url 'home' %}">
urls code:
urlpatterns = [ path('admin/', include('admin_llda.urls') ), path('about/', views.about, name = 'about'), path('dashboard/',views.dashboard, name = 'dashboard'), path('',views.homepage, name = 'home') ]
Check that you have properly named the name
kwarg in your urls
file. It's a keyword argument, not an argument. So you should type the keyword and the value.
For example your current urlpatterns
list in one of your installed apps urls.py
file looks like this:
urlpatterns = [ path('', views.index, 'index'), path('like/', views.like, 'like') ]
You should check if you have missed the name
kwarg. The above code should be changed to:
urlpatterns = [ path('', views.index, name='index'), path('like/', views.like, name='like') ]
If you want to find it faster, you can comment each app's url inclusion, in the your_project/urls.py
file. When the error is gone, it means that you should check the commented app urls.py
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With