hey guys, got the solution:
for each field to validate, I wrote a validate function:
code snippet:
def clean_:
try:
UserProfile.objects.get(phone_num=self.cleaned_data[''])
except UserProfile.DoesNotExist:
return self.cleaned_data[""]
raise forms.ValidationError(("FIE
@ 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.seri
If you ever want to know how the UserCreationForm works, the source is
always available not only on your machine but also on
https://github.com/django/django/blob/master/django/contrib/auth/models.py
On Wednesday, April 24, 2013 9:27:39 AM UTC-6, sachin wrote:
>
> Hello,
>
> I m extending my au
Thanx Siddharth and Pradeep, I will try both suggestion and let you know
On Thu, Apr 25, 2013 at 2:07 PM, Pradeep Kumar wrote:
> Hi Sachin,
>
> If you have added the unique=True later and migrated the existing table, I
> would also suggest you to first clean up the NULL and duplicate entries
>
Hi Sachin,
If you have added the unique=True later and migrated the existing table, I
would also suggest you to first clean up the NULL and duplicate entries
using a script or even from shell.
After doing that you can use
* try: *
# your code here
* except IntegrityError: *
#create v
hi Sachin,
Please use django's form clean method in order to validate your phone_num
field.
You can also override the django's clean method by using your own
clean_phone_field method.
Please refer the link:-
https://docs.djangoproject.com/en/dev/ref/forms/validation/
I am sure that a small googl
Hello,
I m extending my auth user model to add addition entries like phone numbers
and emp_id. In the model I m marking both the fields as unique=True.
Form generation is using UserCreationForm. But whenever I try to save same
phone number or emp_id it throws
*IntegrityError: (1062, "Duplicate
7 matches
Mail list logo