Thursday, September 10, 2020

Re: I am getting this error plz help me out of this.

In your views function you passed a (pk) so you must pass it in your path in (urls.py) as
path('postdetail/<int:pk>/', views.post_detail, name='post_detail') 
Then in your template in(href="{% url 'appname:post_detail' post.id %}") 
and you will redirect to your  url as (localhost:port/postdetail/1) or 2 or 3 or 4 ..... or whatever
hope this helps    

On Thursday, September 10, 2020 at 4:08:18 PM UTC+2 mailto...@gmail.com wrote:
url for post_detail should have <pk>

On Thu, Sep 10, 2020 at 7:30 PM Yash Lanjewar <yashlan...@gmail.com> wrote:
1.png
2.png
3.png
4.png

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAM%3DybSOsbGWm-9LvGYgu5QpNQZA%3DZvGY00C%2Bj5CHuoiG8nmFxQ%40mail.gmail.com.


--
Thanks & Regards 
  
Regards, 
Danish

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d25aa9e1-d753-4c6e-83a7-fcda03731514n%40googlegroups.com.

No comments:

Post a Comment