Opened 16 months ago
Last modified 16 months ago
#35585 closed Bug
`Query.has_results` calls `.exists()` with wrong argument — at Initial Version
| Reported by: | Flavio Curella | Owned by: | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev | 
| Severity: | Normal | Keywords: | |
| Cc: | Flavio Curella | Triage Stage: | Ready for checkin | 
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | yes | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
The has_results method of the Query class (in django/db/models/sql/query.py), passes the using argument to the exists() method:
`python
def has_results(self, using):
q = self.exists(using)
compiler = q.get_compiler(using=using)
return compiler.has_results()
`
but the signature of the exists method does not accept an argument to select the db connection. It only accepts an argument to limit the rows it should fetch:
`python
def exists(self, limit=True):
# ... snip ...
`