On Mon, Nov 16, 2009 at 5:12 PM, Adam Stein <a...@eng.mc.xerox.com> wrote:
> Running Django v1.1.1 on Apache v2.2.8 with Firefox v3.5.4.
>
> I have a very simplified and unreal example below to demonstrate what's
> happening.
>
>8 --
>
>    def clean(self):
>        cleaned = self.cleaned_data
>
>        if not cleaned.has_key("string2") and
> cleaned.has_key("string1"):
>            cleaned["string2"] = string1
>
>        return cleaned
>8 --
>
> What happens is that Django comes back with an error message because
> 'string2' is required and has no associated value.  Is there any way to
> set a field value that get's POST'd?

clean() is run after the built-in validation and per-field validation.
You'll want to copy request.POST, set the value there, and then feed
it to the form. Or make string2 not required and do it in clean the
way you do now.

-- 
Dennis K.

Time is an illusion, lunchtime doubly so.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.


Reply via email to