1👍
You are not sending the post
object in the template context.
You need to send post
object in the context as @cdvv7788 also mentioned. Since, you are not sending the post
object in the context, the template is not able to generate the url properly.
You need to do something like:
def my_view(request):
...
context_dict = {'post': post, ..} # pass the 'post' object
# here 'some_template.html' is the template containing this url
return render(request, 'some_template.html', context_dict)
Source:stackexchange.com