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

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -