I want to have my custom "/login" page. So in settings.py I did a simple LOGIN_URL = '/login'. But before doing it, I want to develop all other more complex pages. I found a simple but very effective hack like this:
urlpatterns = [ # blabla url(r'^admin/', include(admin.site.urls)), url(r'^login/$', RedirectView.as_view( url=reverse_lazy('admin:login'))), # blabla ] This means: when the user is not connected he/she is redirected to /login. In the urls, /login is converted to 'admin:login' which is admin/login. This is a "double" redirect. Everthing works fine except this:
- origin URL: "
/my_jobs" - redirected to "
login?next=/my_jobs" - redirected to "
/admin/login"
So my problem is that I want do pass again the "next" parameter in the RedirectView. I found a lot about redirection and custom login, but not something about that on stackoverflow (this is not a duplicate).