python - How to Call loggedin username in Django url -
I have a login url, after the user logs in, it is being called as Bile: < / P>
(R '^ $', RedirectView.as_view (url = '/ home /')), I give the logged in user name in the above URL Want me, like
(r '^ $', RedirectView.as_view (url = '& lt; username';);), < P> Please suggest.
Would like to suggest getting a RedirectView class in a view such as: ReedirectView> RedirectView: pattern_name = 'home' def get_redirect_url (auto, * args, ** kwargs): return "/user/{}/".format(self.request User) urls.py : (r '^ $', HomeRedirectView.as_view ()),
Comments
Post a Comment