-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
baker.make only creates value for username on Django's User model #74
Comments
Greetings @mazulo ! By default, model_bakery will skip fields with However, I have a couple of suggestions here for you:
Please, tell me if something is unclear and/or confusing! Best, P.S. Not related to the library, but I would highly recommend not to use |
Hey @mazulo thanks for opening this and @amureki for helping us out =) But, actually, there's an even better approach to populate non-required fields with the user = baker.make(User, _fill_optional=True)
## OR
user = baker.make(User, _fill_optional=['email']) The first one will populate all optional fields, meanwhile the second only the I now realized that we don't cover the |
I've specifically addressed the docs issue on #79, so I'm closing this one, ok? |
That makes a lot of sense. Thank you folks @amureki and @berinhard for the explanation and the hard work on this awesome lib! |
Short summary.
I'm not sure if I'm missing something, and please let me know if I am, but whenever I create a user with
baker.make
it creates a user but onlyusername
has value in it. I'd expect.make
to generate values for the other fields it supports, likeEmailField
.Expected behavior
baker.make(User)
would create random values for all fields it supports, includingEmailField
.Actual behavior
It doesn't create an
email
value for the user.Reproduction Steps
How to reproduce this issue.
Versions
Python: 3.6.9
Django: 1.11.29
Model Bakery: 1.1.0
Also tested on
Versions
Python: 3.8.3
Django: 3.0.6
Model Bakery: 1.1.0
The text was updated successfully, but these errors were encountered: