开发者

Why are my Django GAE requests returning "Property details must be a str or unicode instance, not a BoundField"

Why does the commented out code work, while the other code returns开发者_如何学运维 a BoundField error? Shouldn't they be equivalent?

form = PostForm(request.POST)
post = Post(title = form['title'], details = form['details'])
#post = Post(title = request.POST['title'], details = request.POST['details'])

Also, I fear the title to this question makes no sense.


No, they're not equivalent.

form.data['title'] would be the equivalent of request.POST['title']

And if you want the processed data, try this:

form.is_valid()
form.cleaned_data['title']
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜