"query" param for Model.objects.none() queryset has unexpected value.
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
- Create Django model:
class Location(models.Model): name = models.CharField(max_length=100)
- Get a null set
res = Location.objects.none()
- Check the SQL relating to this set:
print(res.query.sql_with_params()) >> ('SELECT "name" FROM "location", ())
The SQL above would actually return all the records in the database. My expectation is that I'd get the same result here as when I do the following:
query = Location.objects.filter(id__in=) print(query.sql_with_params())
This, in fact, throws an EmptyResultSet error which seems reasonable as there's really no SQL statement to go along with a purposefully empty set.