On Tue, Nov 4, 2008 at 12:07 PM, Rick <[EMAIL PROTECTED]> wrote:

>
> Give a man a fish...
>
> Right, so I see now what's going on. Is this the right place to argue
> about how this works?
>

It isn't clear what you see or what you want to argue about?

cleaned_data is established when the form is validated and is deleted if the
entire form does not pass validation (though I think there is a ticket open
that asks for cleaned_data to stick around with the valid values that did
pass validation, so that might change).

There is no way to validate part of a form -- it is all-or-nothing.  If you
want to check for an error on a specific field, then check for the existence
of that field's name in the errors dictionary after calling is_valid().
(You can also verify that you get the exact error message you are looking
for, if you like.)

Karen


>
> ---Rick
>
>
> On Nov 4, 8:46 am, Rick Kitts <[EMAIL PROTECTED]> wrote:
> > Thanks, it does but this is a bad test methodology. is_valid()
> > verifies the entire form and there is no way of knowing in the test if
> > the validation is failing because of other reasons or the specific one
> > I (think) I'm testing.
> >
> > I guess the broader question then is when is cleaned_data established?
> > It appears transient since if I call the clean_xxx() method after
> > calling is_valid() then I still get the attriberr.
> >
> > ---Rick
> >
> > On Nov 4, 2008, at 5:10 AM, Dan Fairs wrote:
> >
> >
> >
> > >> Running the test causes a splash of barf that says:
> >
> > >> AttributeError: 'TheFormClass' object has no attribute 'cleaned_data'
> >
> > > Try calling form.is_valid() (which should in addition return whether
> > > the validation framework as a whole thought the form was valid). This
> > > should invoke your clean_ method.
> >
> > > Cheers,
> > > Dan
> >
> > > --
> > > Dan Fairs <[EMAIL PROTECTED]> |http://www.fezconsulting.com/
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to