Skip to content

Commit 5adb187

Browse files
committed
Avoid project field collision.
1 parent a76349f commit 5adb187

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

django_mongodb/compiler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,8 @@ def get_project_fields(self, columns=None, ordering=None):
492492
fields[alias] = 1
493493

494494
for column, _ in ordering or []:
495-
if column not in fields:
495+
foreign_table = column.split(".", 1)[0] if "." in column else None
496+
if column not in fields and foreign_table not in fields:
496497
fields[column] = 1
497498

498499
return fields

0 commit comments

Comments
 (0)