问题
My code:
def return_post:
form = SQLFORM(db.post)
for c in form:
form1= post.body
form2 = form1.split()
return dict(form2=form2)
In view:
{{=form2}}
I get the error that form2 is not defined. The above is the actual code. I had actually posted this from the Samsung tab and could not get the curly brackets.
回答1:
You have to use =form2
within curly braces, not parenthesis.
{{=form2}}
Change it and try again. If using your tablet, try copy-pasting the above line. That should work.
来源:https://stackoverflow.com/questions/23765545/why-do-i-get-this-error-form2-not-defined