@ Kelly: thank you very much for pointing me to django's source code.
Yes I got that validation done and applied the same code for validation. Below is the snippet :
profile.serial_num = self.cleaned_data['phone_num']
try:
profile._default_manager.get(phone_num=profile.serial_num)
except UserProfile.DoesNotExist:
profile.serial_num = profile.phone_num
raise forms.ValidationError("Phone number already exist")
@ all
Now the next problem is, similar snippet appears in
/site-packages/django/contrib/auth/forms.py
throws an error in the template form itself, but my code only shows up error in django's traceback, how can I bring it to front ?
so that as soon as one fills phone number field it and press submit, it should say 'Phone number already exist'.
m I doing wrong in using UserCreationForm ? or UserProfile. I m using user.get_profile() for profile fields.