Post Details

views.py

def post_view(request,post_title) :
    post = get_object_or_404(Post,title=post_title)         
    return render(request,'blog/details.html',{'post':post})  

html

    {{post.title}} <br>
    {{post.content}} <br>
    {{post.categories}} <br>
    {% for tag in post.tags %}
    <button>{{tag.name}} </button> 
    {% endfor %}

urls

    path('post_view/<str:post_title>',views.post_view,name='post_view'),   

Last updated