change order by key to table alias as this one should be unique, name of the field dont have to be, fill release

This commit is contained in:
collerek
2021-01-06 16:48:16 +01:00
parent 4e0a6cefe9
commit 1df274b6e0
2 changed files with 3 additions and 2 deletions

View File

@ -20,6 +20,7 @@ as the same model can be registered multiple times and `ormar` needs to know fro
* Fix minor bug in `order_by` for primary model order bys
* Fix in `prefetch_query` for multiple related_names for the same model.
* Fix using same `related_name` on different models leading to the same related `Model` overwriting each other, now `ModelDefinitionError` is raised and you need to change the name.
* Fix `order_by` overwriting conditions when multiple joins to the same table applied.
## Docs
* Split and cleanup in docs:

View File

@ -400,11 +400,11 @@ class SqlJoin:
)
if not current_table_sorted:
order = text(f"{alias}_{to_table}.{pkname_alias}")
self.sorted_orders[f"{part}.{pkname_alias}"] = order
self.sorted_orders[f"{alias}.{pkname_alias}"] = order
else:
order = text(f"{alias}_{to_table}.{pkname_alias}")
self.sorted_orders[f"{part}.{pkname_alias}"] = order
self.sorted_orders[f"{alias}.{pkname_alias}"] = order
@staticmethod
def get_to_and_from_keys(