Skip to content

How to retrieve a BitField flag value in a queryset filter using values_list. #98

@0xLuz

Description

@0xLuz

I have a model with BitField like this:

class MyModel(models.Model):
        notifications = BitField(flags=('facebook', 'email'))

I would like to filter my model just retrieving the values, but the BitField is unable to return the flag values independently. I have unsuccessfully tried:

MyModel.objects.all().values_list(
     'id', 'notifications__facebook', 'notification__email'
)

Is there a way to make it work?

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