On Thu, Apr 14, 2011 at 5:32 AM, ricksteu <rick_s...@yahoo.com> wrote:
>
> Hello -
>
> I am looking for a straightforward way to alter posted form data prior
> to when the form's full_clean() method is called.  Specifically, I
> need to strip whitespace from any string data (such as for
> CharFields), and this needs to be done prior to when the individual
> fields' clean methods are called.
Maybe I'm a bit confused, but is it not the fields cleanup method that
would be responsible for actually cleaning up its data, besides
validating?

If you really must clean it before that, the best way indeed seems to
extend the form and overload its clean method, im not sure wich one,
there's two to look at, I recall the one was more convenient to use
then the other, as it simply just called the other method. It is
indeed responsible for calling the clean method on its fields if I'm
not mistaken, so thats the route I would choose in this case.

Also yes, you could make a copy of the POST data, modify that and pass
it to the form constructor, but as you mentioned that doesnt seem very
nice way to handle things.

Hope this is of some assistance.

-- 
Regards, Yuka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to