Default severity: warning · Applicability: suggestion · Category: model
Detects null=True on a CharField or TextField. Django’s own docs advise against it: a nullable string column has two distinct “no data” values — NULL and the empty string '' — so every consumer must check both, and lookups like field='' silently miss NULL rows. The Django convention is a NOT NULL column with blank=True for form-layer optionality, storing '' for absent values. The QuickFix (“Replace null=True with blank=True”) swaps the kwarg in place; it is a suggestion because the change requires a migration and, on existing data, a backfill of NULL to ''.
class Profile(models.Model):
bio = models.TextField(null=True)
class Profile(models.Model):
bio = models.TextField(blank=True)
# orm-lens-disable-next-line DOL011
Legitimate exception: unique=True string fields where multiple absent values must not collide — suppress there. Or per-workspace in .vscode/settings.json: {"djangoOrmLens.rules": {"DOL011": "off"}}.