简体   繁体   中英

How can I fix this attribute error?

Am working on a web2py HTML view but keep getting an erros. 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:

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. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM