add more test with inheritance, fix ordering of subquery in first and get, regenerate api docs with only documented items

This commit is contained in:
collerek
2021-01-06 14:35:18 +01:00
parent bca77a3687
commit e42bf110cd
28 changed files with 139 additions and 437 deletions

View File

@ -88,9 +88,9 @@ class Query:
for clause in self.order_columns:
if "__" not in clause:
text_clause = (
text(f"{self.alias(clause[1:])} desc")
text(f"{self.table.name}.{self.alias(clause[1:])} desc")
if clause.startswith("-")
else text(self.alias(clause))
else text(f"{self.table.name}.{self.alias(clause)}")
)
self.sorted_orders[clause] = text_clause
else:
@ -202,11 +202,7 @@ class Query:
for filter_clause in self.exclude_clauses
if filter_clause.text.startswith(f"{self.table.name}.")
]
sorts_to_use = {
k: v
for k, v in self.sorted_orders.items()
if k.startswith(f"{self.table.name}.")
}
sorts_to_use = {k: v for k, v in self.sorted_orders.items() if "__" not in k}
expr = FilterQuery(filter_clauses=filters_to_use).apply(expr)
expr = FilterQuery(filter_clauses=excludes_to_use, exclude=True).apply(expr)
expr = OrderQuery(sorted_orders=sorts_to_use).apply(expr)