On 9/13/06, Rob Hudson <[EMAIL PROTECTED]> wrote:
>
> (I'm not an official "dev" so I hope it's not considered inappropriate
> of me to provide my feedback.)

It's not inappropriate at all. :)

> Instead of the assumption that bind() validates, why not have an
> is_valid() method that assumes binding of the Form.  To me this is a
> more appropriate assumption since you have to bind the form to validate
> it.  And it leaves some flexibility open so you can bind forms and not
> yet validate -- say if you want to bind and do some other form actions
> and then validate.

[snip]

>         form = ShoppingForm()
>         if request.method == POST:
>                 form.bind(request.POST)
>                 if form.billing_same_as_shipping == True:
>                         # Copy billing info to shipping
>                         form.shipping = form.billing
>                 if form.is_valid():
>                         ...

You make a good point. I was focusing on the simplest case in my
example, but we might as well spell out how more complex cases would
work. I think having separate mehods - 'is_valid', 'bind', and
probably 'process' as well (that does both, see my response to Ivan
Sagalaev) - would be a good idea.

Joseph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to