#34013: order_by() crashes with annotated JSONObject fields.
-------------------------------------+-------------------------------------
     Reporter:  Eugene Morozov       |                    Owner:  Aman
                                     |  Pandey
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  orm, json, ordering  |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Rodolfo Valentín Becerra García):

 Try this

 {{{
 Model.objects.all().annotate(
     json_field=functions.JSONObject(
         test_pk=models.Value(100) + models.F("pk"),
     ),
     test_pk_from_json_field=KeyTextTransform(
         "test_pk", "json_field"
     )
 )
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34013#comment:7>
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/01070184ecbcec64-9c2a9254-9bc1-4053-9306-d812f15f1f40-000000%40eu-central-1.amazonses.com.

Reply via email to