In ur anchor tag in template {% url "xyz:rst" post.pk %}
On Thu, 10 Sep 2020, 20:15 amr <[email protected]> wrote:
> 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 [email protected]
> wrote:
>
>> url for post_detail should have <pk>
>>
>> On Thu, Sep 10, 2020 at 7:30 PM Yash Lanjewar <[email protected]>
>> wrote:
>>
>>> [image: 1.png]
>>> [image: 2.png]
>>> [image: 3.png]
>>> [image: 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAM%3DybSOsbGWm-9LvGYgu5QpNQZA%3DZvGY00C%2Bj5CHuoiG8nmFxQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAM%3DybSOsbGWm-9LvGYgu5QpNQZA%3DZvGY00C%2Bj5CHuoiG8nmFxQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d25aa9e1-d753-4c6e-83a7-fcda03731514n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d25aa9e1-d753-4c6e-83a7-fcda03731514n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAJAxQD%3DvjnGNPsPbOsZBLSP0UDGRunX82c7QQ7PJJ%3Dy1mjGjWw%40mail.gmail.com.