I’m having trouble with my URL forwarding after successful login.
The django default for ‘LOGIN_REDIRECT_URL’ is ‘/accounts/profile/’. In my case it should forward to ‘/user/{{ user.username }}/’
I went to overwrite it in my settings file but have encountered a syntax issue. Here’s the code:
LOGIN_REDIRECT_URL = "/user/%s/" % user.username
When I use the following line in my login form, it works, but only if the page is reloaded first. Kinda strange.
<input type="hidden" name="user" value="/user/{{ user.username }}/" />
So what changes must I make to my settings.py to load the username on redirect?
Thanks.
You may want to create a custom login instead and use the views described in django user authentication.
Of course overriding the view where /accounts/profile/ points to and manually setting the redirect url there is an option, but its not a very elegant solution.