Re: Trouble setting a form field's value in clean()

2009-11-16 Thread Adam Stein
Ok, thanks for the example. On Mon, 2009-11-16 at 11:27 -0800, pjrhar...@gmail.com wrote: > > if not cleaned.has_key("string2") and > > cleaned.has_key("string1"): > > cleaned["string2"] = string1 > > > > return cleaned > > > I think the problem here is that if string2

Re: Trouble setting a form field's value in clean()

2009-11-16 Thread pjrhar...@gmail.com
>         if not cleaned.has_key("string2") and > cleaned.has_key("string1"): >             cleaned["string2"] = string1 > >         return cleaned > I think the problem here is that if string2 is not required it will be in the cleaned dictionary but an empty string. So instead you might need: if

Re: Trouble setting a form field's value in clean()

2009-11-16 Thread Adam Stein
On Mon, 2009-11-16 at 17:57 +0100, Dennis Kaarsemaker wrote: > On Mon, Nov 16, 2009 at 5:12 PM, Adam Stein 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.

Re: Trouble setting a form field's value in clean()

2009-11-16 Thread Dennis Kaarsemaker
On Mon, Nov 16, 2009 at 5:12 PM, Adam Stein 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 > >

Trouble setting a form field's value in clean()

2009-11-16 Thread Adam Stein
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. class MyForm(forms.Form): string1 = forms.CharField() string2 = forms.CharField(widget = forms.HiddenInput()) def clean(self):