I have an error that I can not find:
NoReverseMatch at and Error during template rendering:
I have an error that I can not find:
NoReverseMatch at and Error during template rendering:
The format you are using for the url is not correct, see:
# definición en urls.py
url(r'^blog/post/(?P<pk>[0-9]+)/$', views.post_detail, name="post_detail"),
# Uso en post_list.html
<h1><a href="{% url 'post_detail' post.pk %}">{{ post.title }}</a></h1>
It is good practice to add the name attribute to your urls, combining this with the namespace you can identify the urls in a better way.
When you have problems with the urls you can do this in the shell to get more information:
>>> from django.urls import reverse
>>> reverse('post_detail', args=[str(self.id)])
You need to add that url to your urls.py file and create the view that responds to that url.
Both should receive the parameter 'pk'
Greetings.