I am trying to write a url.py where I have a simple view for users
urlpatterns = patterns( 'doors.view',
url( r'^users/$' , 'users_list' , name = 'users_list' ),
url( r'^users/(?P<pk>\d+)/$', 'users_detail', name = 'users_detail' ),
url( r'^users/self/$' , # do some sort of redirect here ),
)
The problem with the redirect is I don’t know the pk of the logged in user in url.py. In view.py, I would obviously do a @login_required to be able to access users/self/.
Maybe I am doing this wrong way? What do you guys suggest I do?
My suggestion (not sure if it’s the easiest one) would be to create a new view, where you can grab the user’s pk and then call the
users_detailview: