On Mon, Jun 8, 2009 at 10:09 AM, zayatzz <alan.kesselm...@gmail.com> wrote:

>
> So i change pwd and pwdc to required=False and in clean i do
> if pwd in data (or if   ["pwd"] not in data):
>    if data.get("pwd") != data.get("pwdc"):
>        raise forms.ValidationError("Passwords do not match")
> return data
>
> and i get errorfree clean function?
>
> Alan
>

No think more simple than that really:

if cleaned_data['pwd'] != '':
  if cleaned_data['pwd'] != cleaned_data['pwdc']:
    raise ...
return ...

There will always be pwd in cleaned_data, if it is empty, it will be an
empty string.

Hope that works for you,

Michael

--~--~---------~--~----~------------~-------~--~----~
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