Skip to content

Commit 76cfc14

Browse files
fix values_list fields order (#1492)
* fix values_list fields order ValuesListQuery return wrong order list when the number of fields is greater than 10. * update changelog --------- Co-authored-by: long2ice <[email protected]>
1 parent 3fc4ea0 commit 76cfc14

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Added
1818

1919
Fixed
2020
^^^^^
21+
- Fix order of fields in `ValuesListQuery` when it has more than 10 fields. (#1492)
2122
- Fix pydantic v2 pydantic_model_creator nullable field not optional. (#1454)
2223

2324
0.20.0

tortoise/queryset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ async def _execute(self) -> Union[List[Any], Tuple]:
15071507
_, result = await self._db.execute_query(str(self.query))
15081508
columns = [
15091509
(key, self.resolve_to_python_value(self.model, name))
1510-
for key, name in sorted(self.fields.items())
1510+
for key, name in self.fields.items()
15111511
]
15121512
if self.flat:
15131513
func = columns[0][1]

0 commit comments

Comments
 (0)