CODE:
def show_post(request, pk):
post = get_object_or_404(Post,pk=pk)
brand = Category.objects.get(id=post.category)
return render(request, 'post.html', {'post':post, 'brand':brand})
If your model uses a different name for the primary key field, you should use that name instead. For above code, I used id=post.category but primary key field is id_category. so I changed it.
brand = Category.objects.get(id_category=post.category)