#34013: order_by() crashes with annotated JSONObject fields.
-------------------------------------+-------------------------------------
     Reporter:  Eugene Morozov       |                    Owner:  Aman
                                     |  Pandey
         Type:  Bug                  |                   Status:  assigned
    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 Aman Pandey):

 "It seems there is a lack of support JSONField in order_by queryset."
 this is not true as JSONField based example queryset is working fine with
 order_by method
 eg:
 """"
 class Dog(models.Model):
     name = models.CharField(max_length=200)
     data = models.JSONField(null=True)

     def __str__(self):
         return self.name
 """"

 >>> dogs = Dog.objects.all().order_by("data")
 >>> dogs
 <QuerySet [<Dog: stella>, <Dog: tuffy>, <Dog: shifu>, <Dog: milo>]>

 this is working ..
 can someone please tell me about this model attribute how does this
 assigned to the object
 or wheather i should start with annotate class?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34013#comment:3>
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/0107018347c019da-a806590d-0c2e-4855-9f53-e0023013709a-000000%40eu-central-1.amazonses.com.

Reply via email to