Re: unique_true option of the fields works as case-sensitive, how can we make it case-insensitive?

2007-09-06 Thread RajeshD



On Sep 4, 9:28 am, parabol <[EMAIL PROTECTED]> wrote:
> When I mark a field as unique_true is works as case-sensitive and does
> not catch something like "problem" and "Problem".  What is the correct
> way of making it case-insensitive? Thus it will catch even "problem"
> and "ProBLem".
>
> I tried to override the save() method, but this time the thrown
> exception (Integrity Error) is not catched by the admin form.
>
> What do you suggest?

1. Use a custom validator (you will need to make a DB call within your
validator to look for the existence of another record with the field
value in question)

2. Add a SlugField to your model, define it to be unique, and
prepopulate it from the field that's supposed to be case-insensitively
unique. Then, you will get the right validation errors in the admin
(but they will be shown against the slug field.)


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



unique_true option of the fields works as case-sensitive, how can we make it case-insensitive?

2007-09-04 Thread parabol

When I mark a field as unique_true is works as case-sensitive and does
not catch something like "problem" and "Problem".  What is the correct
way of making it case-insensitive? Thus it will catch even "problem"
and "ProBLem".

I tried to override the save() method, but this time the thrown
exception (Integrity Error) is not catched by the admin form.

What do you suggest?


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