We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4640324 commit 9bd5b59Copy full SHA for 9bd5b59
django_mongodb/compiler.py
@@ -90,7 +90,13 @@ def check_query(self):
90
"""Check if the current query is supported by the database."""
91
if self.query.is_empty():
92
raise EmptyResultSet()
93
- if self.query.distinct:
+ if self.query.distinct or getattr(
94
+ # In the case of Query.distinct().count(), the distinct attribute
95
+ # will be set on the inner_query.
96
+ getattr(self.query, "inner_query", None),
97
+ "distinct",
98
+ None,
99
+ ):
100
# This is a heuristic to detect QuerySet.datetimes() and dates().
101
# "datetimefield" and "datefield" are the names of the annotations
102
# the methods use. A user could annotate with the same names which
0 commit comments