Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django TypeError:logout()至少接受1个参数(给定1个)_Django_Django Authentication - Fatal编程技术网

Django TypeError:logout()至少接受1个参数(给定1个)

Django TypeError:logout()至少接受1个参数(给定1个),django,django-authentication,Django,Django Authentication,我不明白为什么这个url会给我一个错误: from django.contrib.auth import views as auth_views from django.core.urlresolvers import reverse_lazy ... url(r'^logout/$', auth_views.logout(next_page=reverse_lazy("dashboard:operations_login")), name="operations_logout"), ...

我不明白为什么这个url会给我一个错误:

from django.contrib.auth import views as auth_views
from django.core.urlresolvers import reverse_lazy

...
url(r'^logout/$', auth_views.logout(next_page=reverse_lazy("dashboard:operations_login")), name="operations_logout"),
...
错误是:

Django TypeError:注销至少需要1个给定的参数1


您直接在url定义中调用注销视图

如果需要传递参数,则应在单独的字典中传递:

url(r'^logout/$',
    auth_views.logout,
    {'next_page': reverse_lazy("dashboard:operations_login")},
    name="operations_logout"),

您直接在url定义中调用注销视图

如果需要传递参数,则应在单独的字典中传递:

url(r'^logout/$',
    auth_views.logout,
    {'next_page': reverse_lazy("dashboard:operations_login")},
    name="operations_logout"),