On 5/08/2023 7:58 pm, Chetan Ganji wrote:
Hi Mike

RE: The primary use case is to establish case-insensitivity when checking names - including usernames, company names and abbreviations/acronyms.

I dont know anything about db_collation.

Me neither

Below 4 lookups should solve most common scenarios.

Actually that was how I did it originally. I switched to using the PostgreSQL CI field because it is all done in the database - much faster - and my code is much reduced and therefore fewer possibilities for bugs etc.

Judging from the Django release notes and the PostgreSQL docs there should be a straightforward answer to my question. Researching the correct answer is complex enough to make me ask here first.

Cheers

Mike

https://docs.djangoproject.com/en/4.2/ref/models/querysets/#field-lookups



Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Sat, Aug 5, 2023 at 1:35 PM Mike Dewhirst <mi...@dewhirst.com.au> wrote:

    The following warning triggered a bit of research which looks like
    a significant amount of study will be required to find the
    collation needed ...


    django.contrib.postgres.fields.CICharField is deprecated. Support
    for it (except in historical migrations) will be removed in Django
    5.1.
            HINT: Use CharField(db_collation="…") with a
    case-insensitive non-deterministic collation instead.


    Does anyone have experience they would like to share? What
    replaces that ellipsis?

    The primary use case is to establish case-insensitivity when
    checking names - including usernames, company names and
    abbreviations/acronyms. Maybe there is a better way to handle that?

    This is my typical PostgreSQL database spec ...

    CREATE DATABASE xxxx
        WITH
        OWNER = miked
        ENCODING = 'UTF8'
        LC_COLLATE = 'C'
        LC_CTYPE = 'C'
        TABLESPACE = pg_default
        CONNECTION LIMIT = -1
        IS_TEMPLATE = False;

    Many thanks for any help

    Cheers

    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.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/django-users/2eccab9e-e296-55e0-05de-e8d4cf708262%40dewhirst.com.au
    
<https://groups.google.com/d/msgid/django-users/2eccab9e-e296-55e0-05de-e8d4cf708262%40dewhirst.com.au?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/CAMKMUjuxfeV5m4QiPz1jEyh7fRobqZn7SCp4dnXnjrSOBirh7Q%40mail.gmail.com <https://groups.google.com/d/msgid/django-users/CAMKMUjuxfeV5m4QiPz1jEyh7fRobqZn7SCp4dnXnjrSOBirh7Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.


--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.

--
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/e3d57fb4-5899-a04c-f2b8-f39591c978c7%40dewhirst.com.au.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to