如何将自定义表单传递给django.contrib.auth.views.login

时间:2015-03-24 05:01:12

标签: django forms login

我正在尝试将自定义模板和表单传递给auth.views.login。我收到错误消息。这有什么问题?

在views.py中

def login_user(request, template_name='login.html', 
           redirect_field_name = None, 
           authentication_form = BootstrapAuthenticationForm,
           extra_context=None):
response = auth.views.login(request, template_name, redirect_field_name, authentication_form)

1 个答案:

答案 0 :(得分:0)

您应返回您视图中的回复:

def login_user(request, template_name='login.html', 
           redirect_field_name = None, 
           authentication_form = BootstrapAuthenticationForm,
           extra_context=None):
    return auth.views.login(request, template_name, redirect_field_name,
                            authentication_form)