Opened 3 years ago
Last modified 3 years ago
#32882 closed Bug
Problems when comparing two fields with None value using F() in Case() — at Initial Version
Reported by: | Jonathan Souza | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.2 |
Severity: | Normal | Keywords: | F() Case() None != None |
Cc: | jnt.santos12@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Problems when comparing two fields in an annotate.
when = ~Q({ 'name' :
F('order_processname') })
annotate = {
'has_name_divergence': Case(
When(when, then=True),
default=False,
output_field=CharField(),
),
}
When both fields have None value, the case result is true.
None != None
Using postgresSQL
Note:
See TracTickets
for help on using tickets.