Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

NullBooleanField should be treated as BooleanField(null=True, blank=True) #356

Closed
satyanash opened this issue Feb 13, 2018 · 2 comments
Closed

Comments

@satyanash
Copy link

satyanash commented Feb 13, 2018

Currently when using _fill_optional=True, Model Mommy will randomly choose between (None, False, True) for a NullBooleanField.
This feature was added in #305, but I think if _fill_optional=True is specified, it should treat a NullBooleanField the same as a BooleanField(null=True, blank=True) as Django recommends using NullBooleanField where there is a use case for the empty state in a boolean field.

Model Mommy treats None here as a valid non-empty value even though it still means that the field is empty. This confuses any tests that assume that _fill_optional=True will guarantee no None values.

@Nuurek
Copy link
Contributor

Nuurek commented Apr 3, 2018

Somehow related: https://docs.djangoproject.com/en/dev/releases/2.1/

BooleanField can now be null=True. This is encouraged instead of NullBooleanField, which will likely be deprecated in the future.

@berinhard
Copy link
Owner

I'm a 👍 for this change in model mommy.

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

No branches or pull requests

3 participants