class Whatever(models.Model):
name = models.CharField(max_length=200)
is_active = models.BooleanField()
Whatever.object.filter(is_active=True)
Whatever.object.filter(is_active='some_random_text')
Whatever.object.filter(is_active=777)
Whatever.object.filter(is_active=False)
Whatever.object.filter(is_active='')
Whatever.object.filter(is_active=0)
`bool('false') -> True`.
One could say this is again a mistake of the app developer, but my understanding of "explicit is better than implicit" is that Django should explicitly protect me from those mistakes that could stay undetected for a very long time because it just happily silently implicitly converts data types like PHP.
Maybe a backwards compatible solution here would be to provide an `strict=False` parameter to model fields or provide `StrictIntegerField` etc subclasses, although this may end up in a mess.
>>> bool(None)False
Whatever.object.filter(is_active=Value('false'))
The boolean type can have several states: "true", "false", and a third state, "unknown", which is represented by the SQL null value.[1]