Opened 10 years ago
Last modified 10 years ago
#24814 closed Uncategorized
Unable to order_by an ArrayField element. — at Version 1
Reported by: | Matthew Schinckel | Owned by: | |
---|---|---|---|
Component: | contrib.postgres | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
It seems logical that, given a model Foo, with ArrayField bar, we should be able to (using the same rules for querying), perform:
Foo.objects.order_by('bar__0')
However, this does not work. Is this something that _should_ be made to work?
It is possible to perform this query using an OrderBy(RawSQL()) thing, but that's a bit hard to figure out.
It's worth pointing out that the same limitation applies to Hstore fields, and will apply to JSON fields.
At the very least, this should perhaps be documented?
Note:
See TracTickets
for help on using tickets.