Replies: 1 comment 3 replies
-
Hey @kilicluka, thank you for your question!
model_bakery/model_bakery/baker.py Lines 665 to 667 in a408873 We probably need to mention this in the documentation, as it is not quite explicit. One way to solve I see is to explicitly point fields to use certain generators (either during test object creation or in the recipe): User = Recipe(
"User",
name=random_gen.gen_string(64),
last_name=random_gen.gen_string(64),
dob=random_gen.gen_datetime(),
) In theory, we could think of another flag, something like What do you think? |
Beta Was this translation helpful? Give feedback.
-
Let's take this model for example:
using
baker.make("user.User", _fill_optional=True)
or
baker.make("user.User")
will both give the same results. In both cases the
user.name == ""
,user.last_name == ""
anduser.dob == None
. My understanding after reading_fill_optional
docs was that these values would all get randomly generated strings if I provided the argument.Is there a specific reason for this or was it just an oversight?
Beta Was this translation helpful? Give feedback.
All reactions