views:

22

answers:

1

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.

+3  A: 

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']
WoLpH
Thanks! I should have seen it in the documentation, but I always get a little overwhelmed.
ehfeng