Reputation: 648
I was trying to integrate the bootstrap template in my Django project. I have integrated it but I am having an error in the URL.
The following is the error I have:
Codes in template:
<div class="col-md-6 col-sm-12">
<div class="shop-cat-box">
<a href="{% url 'fertilizer-name' %}"><img class="img" src="{% static 'images/cyp/3.png' %}" alt="" /></a>
</div>
</div>
In URL:
urlpatterns=[
path('', findex, name='fertilizer-name'),
path('fertilizer/',predict_chances,name='submit_prediction'),
path('fertilizer/results/',view_results,name='results'),
]
Upvotes: 3
Views: 98
Reputation: 5884
It seems that you’re including the urls.py
in the project with a namespace. In that case, the reverse would be namespace:view
name. Try that in your template inside the url tag and see if that works.
So, i think in your case, in template:
<a href="{% url 'fertilizer:fertilizer-name' %}"><img class="img" src="{% static 'images/cyp/3.png' %}" alt="" /></a>
Upvotes: 1