Re: Case-insensitve unique = True

2020-01-24 Thread gaurav jain
Hi, I think you can save a processed version of the text and apply a unique constraint. If you want save the original text then save the non processed test as well. Kind regards Gaurav Jain On Fri, 24 Jan, 2020, 1:34 pm Mike Dewhirst, wrote: > On 24/01/2020 6:12 pm, maninder singh Kumar wrote:

Re: Case-insensitve unique = True

2020-01-24 Thread Mike Dewhirst
On 24/01/2020 6:12 pm, maninder singh Kumar wrote: I wonder at that.  When I develop a model does the CharField have to be specified case insensitive at that level. That is what Simon advised and I think it is exactly what I want. For instance :  A search can be case insensitive and iexact

Re: Case-insensitve unique = True

2020-01-23 Thread Mike Dewhirst
On 24/01/2020 3:20 pm, Simon Charette wrote: If you are using PostgreSQL I'd suggest using a CIText field[0] with a unique constraint[1]. Surely everyone uses PostgreSQL, no? That [0] is identical in Django 2.2 and it looks like I should migrate my models.CharField to

Re: Case-insensitve unique = True

2020-01-23 Thread maninder singh Kumar
I wonder at that. When I develop a model does the CharField have to be specified case insensitive at that level. For instance : A search can be case insensitive and iexact is the best way. [image: --] Maninder Kumar [image: http://]about.me/maninder.s.kumar

Re: Case-insensitve unique = True

2020-01-23 Thread Simon Charette
If you are using PostgreSQL I'd suggest using a CIText field[0] with a unique constraint[1]. If you are *not* using PostgreSQL your best choice is likely to emulate the upcoming expression[3] support for UniqueConstraint(Lower('field')) by using a RunSQL operation that performs the appropriate

Case-insensitve unique = True

2020-01-23 Thread Mike Dewhirst
What is the best way to ensure a charfield is case-insensitively unique? Currently I'm using a query with __iexact=True but I wonder whether there is a better way. Thanks Mike -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe