[Fixed]-Order by formula

1đź‘Ť

Lacking a more detailed statement of the problem, I will give a vague answer. (to be filled in if more details show up)

You could do this by annotating the queryset with a calculated value. See the documentation here

What this means is that you’re going to ask the database to figure out the “rate”, for example by dividing each shop’s distance by its time, and add that value to the data returned for each shop. You could then do an order_by based on that field.

👤Jon Kiparsky

Leave a comment