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, <mi...@dewhirst.com.au> wrote: > 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 is the > > best way. > > Searching isn't the problem. I don't want duplicate names differing only > in the case and I want that to be enforced at the model level at > instance creation time and also later if the name is edited. > > I have been using iexact to "manually" enforce case insensitive-unique > names. > > Cheers > > Mike > > > > -- > > > > Maninder Kumar > > http://about.me/maninder.s.kumar > > > > <http://about.me/maninder.s.kumar?promo=email_sig> > > > > > > > > On Fri, Jan 24, 2020 at 8:06 AM Mike Dewhirst <mi...@dewhirst.com.au > > <mailto:mi...@dewhirst.com.au>> wrote: > > > > 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 from this group and stop receiving emails from it, > > send an email to django-users+unsubscr...@googlegroups.com > > <mailto:django-users%2bunsubscr...@googlegroups.com>. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/django-users/49ae5424-f079-d4eb-bc6d-aa5231efa773%40dewhirst.com.au > . > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send > > an email to django-users+unsubscr...@googlegroups.com > > <mailto:django-users+unsubscr...@googlegroups.com>. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/django-users/CABOHK3RTRmRwyMsgdryp50vVbBeopqBcu2CCQdrY9aJySjwkpg%40mail.gmail.com > > < > https://groups.google.com/d/msgid/django-users/CABOHK3RTRmRwyMsgdryp50vVbBeopqBcu2CCQdrY9aJySjwkpg%40mail.gmail.com?utm_medium=email&utm_source=footer > >. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/8c6f13f3-1e27-cd55-6ee8-51f0a1dcd039%40dewhirst.com.au > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMiDnWAZF3y_gb%3DyGF46jqLRXoYzBzjO0O1HaPUTK%2BGN-WNApg%40mail.gmail.com.