Thanks Malcolm,

that was it! Newforms are starting to feel fun :)

On Mar 6, 7:03 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-03-06 at 08:45 -0800, Panos Laganakos wrote:
> > Trying to add custom validation for a customer creation form, but when
> > I add:
>
> > def clean_username(self):
> >    try:
> >            user =
> > User.objects.get(username__exact=self.cleaned_data['username'])
> >    except User.DoesNotExist:
> >            return self.cleaned_data['username']
> >    raise forms.ValidationError(_('This username is already taken.'))
>
> What is called cleaned_data in trunk is "clean_data" in 0.96 releases.
> There's an oversight in the documentation that I've just noticed: we
> don't point out that cleaned_data is new in the development release.
>
> Regards,
> Malcolm
>
>
>
> > to check if non/existant, it suppresses the 'required_field' errors,
> > ie: no errors are shown when you put whatever value in the username
> > field (required).
>
> > It works the other way around, meaning if you leave it empty (it shows
> > the 'required_field' error).
>
> > Although I've read that cleaned_data, is not available if the form
> > isn't valid. In that case, when some fields are left empty, I suppose
> > it's invalid, but I can't figure out another way of doing this.
>
> --
> I don't have a solution, but I admire your 
> problem.http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to