Python ';str';对象没有属性';可见字段';
我不断地发现这个错误:Python ';str';对象没有属性';可见字段';,python,django,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> 可能是重复的怎么可能是重复的?@Jack022,你现
'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>
可能是重复的怎么可能是重复的?@Jack022,你现在可能已经明白了这一点,但这只是意味着有人问了一个类似的问题,这里的最佳做法是将类似的问题引用到已经有答案的问题上。
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})