ArrayAgg ordering not working?

220 views
Skip to first unread message

Maya Balakrishnan

unread,
Aug 24, 2018, 4:26:18 PM8/24/18
to Django users
Hi! I'm trying to use an ArrayAgg and order the results in each array. I found this closed ticket which looks like this feature has been created an merged in but when I try doing a query like
Recipe.objects.all().annotate(ingredients_list=ArrayAgg('ingredients__name', ordering='ingredients__id'))
and print out the query it's running it doesn't seem to be attempting to order the ingredients_list. Is there something I'm doing wrong?

Thanks!!
-Maya

Matthew Pava

unread,
Aug 24, 2018, 4:29:49 PM8/24/18
to django...@googlegroups.com

The fix hasn’t been released yet.  It’s in the master branch, and it was committed on June 28.  If I understand it correctly, it should pop up in the next release.  https://github.com/django/django/pull/7604

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6d38377c-c017-4626-96d1-9a6c1c9573ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maya Balakrishnan

unread,
Aug 24, 2018, 5:23:40 PM8/24/18
to Django users
Ohh that makes sense! Thank you :)


On Friday, August 24, 2018 at 1:29:49 PM UTC-7, Matthew Pava wrote:

The fix hasn’t been released yet.  It’s in the master branch, and it was committed on June 28.  If I understand it correctly, it should pop up in the next release.  https://github.com/django/django/pull/7604

 

 

From: django...@googlegroups.com [mailto:django...@googlegroups.com] On Behalf Of Maya Balakrishnan
Sent: Friday, August 24, 2018 2:29 PM
To: Django users
Subject: ArrayAgg ordering not working?

 

Hi! I'm trying to use an ArrayAgg and order the results in each array. I found this closed ticket which looks like this feature has been created an merged in but when I try doing a query like

Recipe.objects.all().annotate(ingredients_list=ArrayAgg('ingredients__name', ordering='ingredients__id'))

and print out the query it's running it doesn't seem to be attempting to order the ingredients_list. Is there something I'm doing wrong?

 

Thanks!!

-Maya

--
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...@googlegroups.com.

To post to this group, send email to djang...@googlegroups.com.

Jason

unread,
Aug 24, 2018, 9:41:17 PM8/24/18
to Django users
and something to keep in mind when evaluating a project.  just because the master branch has recent commits doesn't mean there are equivalently recent releases.  I've had to pass on a number of promising libs because of this.  Fortunately, django has a much more frequent release cycle.
Reply all
Reply to author
Forward
0 new messages