order_by DictionaryField key

9 views
Skip to first unread message

Ruben Quinones

unread,
Feb 28, 2015, 7:41:07 PM2/28/15
to django...@googlegroups.com

Hi all, I would like to order a queryset based on a key in a DictionaryField I have using hstore. I currently have the following:

objects = MyModel.objects.filter(**items).filter(
                is_private=False).order_by('dict_field')

the contents of the field are the following:

{'1': '100', '2': '150', ..., 'some_key': 'some_value'}

and I would like to sort solely based off the '1' key. The way I have it right now seems to order the results in an ascending order but with the zero values on top, is this possible?

nemesis

unread,
Mar 17, 2015, 11:45:54 AM3/17/15
to django...@googlegroups.com
Hi,

I don't know if this is currently possible, I'm also interested in this.

Federico
Reply all
Reply to author
Forward
0 new messages