Django order_by hstore DictionaryField key

269 Views Asked by At

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.

0

There are 0 best solutions below