vandersonmota/model_mommy — pull request #163 by wolfe (2014-05-20 17:10:41+00:00)
Title: Repair BooleanField so random True/False value is assigned

I realized that I had moved master, and so I'm re-opening this pull request from a feature branch.

Discussion to date:

vandersonmota said: I don't think we should force only for this special case, because it breaks the expectation that blanks and null fields will be ignored by default.
Instead, #148 should provide a way to specify when you want mommy to randomly fill blank/null fields when done.

David said: Hmm --- the problem is that currently, the default behavior is not merely unexpected, but generates an error. Django has already made the choice to break the expectation; we're just living with it.

A settings variable?

(My use case is to write a single unit test which cycles through all models, and attempts to save and retrieve an instance of the model, w/o regard to the model. Having to explicitly specify behavior ONLY for Boolean fields to get it to work seems to break expectations as well. I'd be glad with any approach in which tests pass with the bipolar variable.)