django - order query set by postgres function
Posted
by thebiglife
on Stack Overflow
See other posts from Stack Overflow
or by thebiglife
Published on 2010-04-13T07:56:09Z
Indexed on
2010/04/13
11:13 UTC
Read the original article
Hit count: 228
django
My initial question was here and was related to the postgres backend. http://stackoverflow.com/questions/2408965/postgres-subquery-ordering-by-subquery
Now my problem has moved onwards to the Django ORM layer. I essentially want to order a query by a postgres function ('idx', taken from the above stackoverflow work)
I've gone through trying to use model.objects.extra(order_by ) or simply order_by but I believe both of these need the order_by parameter to be an attribute or a field known to Django.
I'm trying to think how to solve this without having to revert to using an entirely raw SQL query through a model manager.
© Stack Overflow or respective owner