-
-
Notifications
You must be signed in to change notification settings - Fork 553
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
What's wrong
This is more of a feature request (for which I did not find a template).
I would like to have a warning or an error when incorrectly using __isnull filters on a field that cannot be null.
How is that should be
For example, with the following model
class MyModel(models.Model):
name = models.CharField(null=False)I would like to have warnings in the following cases :
MyModel.objects.filter(name__isnull=False) # Always true, this is a noop that should be removed
MyModel.objects.filter(name__isnull=True) # Filters out the entire queryset, probably a mistakeSystem information
- OS: Ubuntu 22.04.5 LTS
pythonversion: Python 3.11.14djangoversion: 4.2.26mypyversion: 1.16.1django-stubsversion: 5.2.1django-stubs-extversion: 5.2.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working