I'm designing a user registration form for my app.  I need to verify
that the username they're using is not already in use before trying to
create the user.  If the username already exists, I want to be able to
generate a form style error that says "Sorry that username is already
in use."

The only way I could find to do is with 'raise ValidationError'()' in
the clean() function.  However, trying to query my User model to see
if that username is already take does not work from the clean()
function.  On the other hand, I cannot find a way to set the error in
the form object from inside the view.

I prefer to do this from inside of the view, rather than from the
clean function.  I already have several validation rules there that I
created, but I'd prefer to keep the Form class separate from my
models.   Any suggestions?

-John

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