incorrect/missing documentation for order_by in database api
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The documentation for order_by in the database api reads the following:
To order by a field in a different table, add the other table’s name and a dot, like so:
However, I believe that in order to be able to sort by a field in another table, (1) the table should be related to each other with a (foreign key) relation to the table we deal with, and (2) one has to use related_objects on this table.
For the given example, the correct code should be, assuming Entry has a ForeignKey to Blog: