Re: When does form.clean get called?

2008-04-09 Thread shabda
>From my code, try: user = User.objects.get(username__iexact = self.cleaned_data['username']) except User.DoesNotExist, KeyError: raise forms.ValidationError('Invalid username, please try again.') if not

Re: When does form.clean get called?

2008-04-08 Thread Malcolm Tredinnick
On Mon, 2008-04-07 at 07:29 -0700, shabda wrote: > So is there a cleaner way to work in form.clean instead of doing > if for.cleaned_datahas_key(field): > for every element? It depends what you want to do in the clean() method. The example you gave in your first post in this thread is not a

Re: When does form.clean get called?

2008-04-07 Thread shabda
So is there a cleaner way to work in form.clean instead of doing if for.cleaned_datahas_key(field): for every element? On Apr 7, 6:06 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Mon, Apr 7, 2008 at 8:19 AM, shabda <[EMAIL PROTECTED]> wrote: > > > If I have a required field and I do not

Re: When does form.clean get called?

2008-04-07 Thread Karen Tracey
On Mon, Apr 7, 2008 at 8:19 AM, shabda <[EMAIL PROTECTED]> wrote: > > If I have a required field and I do not specify a value for the field, > should form.clean get called? My understanding, after reading > > http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation >

When does form.clean get called?

2008-04-07 Thread shabda
If I have a required field and I do not specify a value for the field, should form.clean get called? My understanding, after reading http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation, is that it should not, as clean_ will fail, and so form.clean will not be