-
-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I order by a formula #475
Comments
To echo this request, it would be useful to be able to provide a raw string for the order declaration that doesn't lookup fields. This would allow me to do ordering based on summing different fields or doing an order by |
Yes, this is a good feature. |
Current support order by function already, like await model.annotate(a=Length('field')).order_by('-a') but not for expression, like await model.annotate(idp=F("id") + 1).order_by("-idp").values_list("id", "idp") And will support that in next release. |
Support `F` expression in `annotate`. (#475)
I want to order by formula between two columns. In sql query it look like SELECT * FROM places ORDER BY (latitude-1)+(longitude-1) in SQLite, but i need it in QuerySet. Sorry, my english is well
The text was updated successfully, but these errors were encountered: