#30841: Prevent using __isnull lookup with non-boolean value.
-------------------------------------+-------------------------------------
Reporter: André Ericson | Owner: André
Type: | Ericson
Cleanup/optimization | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by André Ericson):
Replying to [comment:13 felixxm]:
> André, IMO we should deprecate using non-boolean values in Django 3.1
(`RemovedInDjango40Warning`) and remove in Django 4.0 (even if it is
untested and undocumented). I can imagine that a lot of people use e.g.
`1` and `0` instead of booleans.
>
> Attached diff fixes also issue with passing a `F()` expression.
>
> {{{
> def as_sql(self, compiler, connection):
> if not isinstance(self.rhs, bool):
> raise RemovedInDjango40Warning(...)
> ....
> }}}
Sound like a good plan. Not super familiar with the branch structure of
Django. So, I guess the path to follow is to make a PR to master adding
the deprecation warning and eventually when master is 4.x we create the PR
raising the ValueError. Is that right?
Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/30841#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.25e303b6f52b8f29947fb22a4196cad6%40djangoproject.com.