python - Django redirect_authenticated_user: True not working -


i'm writing application in django 1.11.

myapp/urls.py pattern looks like

from django.conf.urls import url, include django.contrib import admin django.contrib.auth.views import loginview  urlpatterns = [     url(r'^login/$', loginview.as_view(), {'redirect_authenticated_user': true}),     url('^', include('django.contrib.auth.urls')),     url('^', include('pages.urls')),     url(r'^pages/', include('pages.urls')),     url(r'^search/', include('search.urls')),     url(r'^admin/', admin.site.urls), ] 

i want logged in user redirected when trying access /login page. have set redirect_authenticated_user true per given in documentation here

but, when access /login after successfull login, not redirect

pass as_view

urlpatterns = [     url(r'^login/$', loginview.as_view(redirect_authenticated_user=true)), 

any arguments passed as_view() override attributes set on class. in example, set template_name on templateview. similar overriding pattern can used url attribute on redirectview.

from simple usage in urlconf


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -