Opened 2 years ago

Closed 2 years ago

#28453 closed Bug (fixed)

transforms are not used for __exact=None lookup

Reported by: Sergey Fedoseev Owned by: Sergey Fedoseev
Component: Database layer (models, ORM) Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Related to #25946.

class NulledTextField(models.TextField):
    pass

@NulledTextField.register_lookup
class NulledTransform(models.Transform):
    lookup_name = 'nulled'
    template = 'NULL'

class TestModel(models.Model):
    nulled_text_field = NulledTextField(null=True)

>>> Season.objects.filter(nulled_text_field__nulled__isnull=True).exists()
True
>>> Season.objects.filter(nulled_text_field__nulled__exact=None).exists()
False

Change History (4)

comment:1 Changed 2 years ago by Sergey Fedoseev

Owner: changed from nobody to Sergey Fedoseev
Status: newassigned

comment:2 Changed 2 years ago by Sergey Fedoseev

Has patch: set

comment:3 Changed 2 years ago by Tim Graham

Component: UncategorizedDatabase layer (models, ORM)
Triage Stage: UnreviewedReady for checkin
Type: UncategorizedBug

comment:4 Changed 2 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 0baea920:

Fixed #28453 -- Made exact=None lookup use transforms.

Note: See TracTickets for help on using tickets.
Back to Top