1👍
✅
Your get_absolute_url
method returns URLs in the form /posts/<id>
but your urlconf is expecting /posts/detail/<id>
.
Instead of hard-coding a URL like that in the method, you should use the reverse
functionality:
from django.urls import reverse
...
def get_absolute_url(self):
return reverse('detail', kwargs={'id': self.id})
Source:stackexchange.com