Skip to content

Why is BooleanField non-null? #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jobevers opened this issue Jul 30, 2018 · 0 comments
Closed

Why is BooleanField non-null? #47

jobevers opened this issue Jul 30, 2018 · 0 comments

Comments

@jobevers
Copy link

jobevers commented Jul 30, 2018

I had a model:

class MyModel(EmbeddedDocument):
    myField = BooleanField(null=True)

and was getting an error about "Cannot return null for non-nullable". It seemed that it didn't matter if I set null=True, null=False. Digging into this, I found:

@convert_mongoengine_field.register(mongoengine.BooleanField)
def convert_field_to_boolean(field, registry=None):
return NonNull(Boolean, description=field.db_field)

Why is this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant