开发者

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

开发者 https://www.devze.com 2023-01-18 13:07 出处:网络
Why does the commented out code work, while the other code returns开发者_如何学运维 a BoundField error?Shouldn\'t they be equivalent?

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

精彩评论

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