[英]How can I fix this attribute error?
Am working on a web2py HTML view but keep getting an erros. 我正在使用web2py HTML视图,但仍会出错。 This is the code:
这是代码:
{{extend 'layout.html'}}
<h2>Edit your post</h2>
<h3>for category {{=form.record.category.name.title()}}</h3>
{{=form}}
and the error: 和错误:
AttributeError: 'NoneType' object has no attribute 'name'
How can i fix the error? 我该如何解决错误?
N/B controller: N / B控制器:
def edit_post():
id = post.id
form = SQLFORM(= A("Edit post",_href=URL(request.args=auth.user.id/login))
return locals()
Please see the SQLFORM documentation about how you create the form. 请参阅有关如何创建表单的SQLFORM文档 。 I assume you've changed the code before you posted it up here, since python wouldn't compile it because of the
=
in the parameter list of SQLFORM
. 我假设您在将代码发布到这里之前已经更改了代码,因为python由于
SQLFORM
参数列表中的=
而不会编译它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.