Opened 7 years ago

Closed 7 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 by Sergey Fedoseev, 7 years ago

Owner: changed from nobody to Sergey Fedoseev
Status: newassigned

comment:2 by Sergey Fedoseev, 7 years ago

Has patch: set

comment:3 by Tim Graham, 7 years ago

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

comment:4 by Tim Graham <timograham@…>, 7 years ago

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