#33935: Support unaccent function in JSONField values
-------------------------------------+-------------------------------------
               Reporter:  Foucauld   |          Owner:  nobody
  Degeorges                          |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  Database   |        Version:  3.2
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:  QuerySet.extra
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 With a JSONField value with the following shape: {{{
 my_object.my_json_field = {"en": "sôme téxt"} }}}

 Doing the following queryset:
 {{{MyModel.objects.filter(my_json_field__en__unaccent__icontains="text")}}}
 does not match the above record, because Django interprets "unaccent"' as
 a key to find in the JSON dict, whereas I meant the PostgreSQL
 {{{unaccent}}} function.

 It seems that {{{ unaccent}}} is only supported on CharField and TextField
 for now, but since what I am trying to do is possible in SQL, it might be
 made possible as well using the ORM.

 Details in this StackOverflow question:
 https://stackoverflow.com/questions/73385812/looking-up-value-in-
 jsonfield-with-unaccent-and-icontains
 .

 I am tagging QuerySet.extra because my workaround was to write the SQL
 where clause I expected using {{{QuerySet.extra}}}.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33935>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182ac2e3437-fb88bf3e-77f7-46b5-8b09-731baa5465ce-000000%40eu-central-1.amazonses.com.

Reply via email to