'str'对象没有属性'visible_fields'

时间:2019-03-11 10:42:01

标签: python django

我不断收到此错误:

'str' object has no attribute 'visible_fields'
{% load bootstrap %}
{{ wizard.management_form }}
<div class="form-horizontal">
      {{ wizard.form|bootstrap_horizontal:'col-sm-3 col-md-3' }}
</div>

但是我真的不知道它来自哪里,有人可以帮助我吗?

这是我的登录视图的样子:

def login_request(request):

    if request.method == "POST":

        if result['success']:
            form = AuthenticationForm(request, data=request.POST)
            if form.is_valid():
                username = form.cleaned_data.get('username')
                password = form.cleaned_data.get('password')
                user = authenticate(username=username, password=password)


                if user is not None:
                    login(request, user)
                    messages.info(request, f"You are now logged in as {username}")
                    return redirect("main:homepage")
                else:
                    messages.error(request, "Invalid username or password")

            else:
                messages.error(request, "Invalid username or password")

    form = AuthenticationForm()
    return render(request,
                  "log.html",
                  {"form":form})

0 个答案:

没有答案