[Answered ]-Link an user to his profile page

2👍

In you template you are trying to use url tag with named urls even though you haven’t passed name keyword argument to url function in your urlpatterns.

In your urls function pass name argument, like this:

url(r'^profile/(?P<profile_id>\d+)/$', views.profile, name='profile'),

make sure you namespaced the app as ‘blog’ in your root url conf.

In your template to access current user’s profile id by request context’s user object. Like this:

{% if user.is_authenticated %}

    <a href= "{% url 'blog:profile' user.userprofile.id %}">Profile</a>
👤v1k45

Leave a comment