Last active
January 29, 2019 17:11
-
-
Save camelcaseblog/360bd39713974b3aa9fd4d3ad234bb5a to your computer and use it in GitHub Desktop.
ORM NULL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class Reporter(models.Model): | |
... id = models.AutoField(primary_key=True, null=False) | |
... name = models.TextField | |
... | |
>>> qs = Reporter.objects.filter(name=None) # 1 | |
>>> print(qs.query) | |
SELECT * | |
FROM reporter | |
WHERE name = NULL | |
>>> qs = Reporter.objects.filter(name__isnull=True) # 2 | |
>>> print(qs.query) | |
SELECT * | |
FROM reporter | |
WHERE name IS NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment