Skip to content

Filtering with MyModel.objects.filter(content='...') does not match any models #3

@dcki

Description

@dcki

Example:

Given a model with a compressed field named content:

>>> m = MyModel.objects.last()
>>> m.id
123
>>> m.content
'abc'
>>> len(list(MyModel.objects.filter(content=m.content)))
0

That should be at least 1, not 0.

These still work though, as documented:

>>> len(list(MyModel.objects.filter(content__in=[m.content])))
1
>>> len(list(MyModel.objects.filter(content__startswith=m.content)))
1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions