We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It is documented that recipes can have callables and iterators as value here
The source code looks like you can do the same thing when not using custom recipes but rather just mommy.make(Class, **attrs): https://github.com/berinhard/model_mommy/blob/2f8948ce1d8ee5c29d097d1890bcf2811ef0e80c/model_mommy/mommy.py#L282 and https://github.com/berinhard/model_mommy/blob/2f8948ce1d8ee5c29d097d1890bcf2811ef0e80c/model_mommy/mommy.py#L284
mommy.make(Class, **attrs)
Also, using it works perfectly fine:
>>> def random_name(): ... return random.choice(["Paul Molive", "Anna Mull", "Gail Forcewind"]) ... >>> users = mommy.make(UserProfile, _quantity=5, last_name=random_name) >>> [u.last_name for u in users] ['Gail Forcewind', 'Anna Mull', 'Gail Forcewind', 'Anna Mull', 'Paul Molive'] >>> >>> name_iterable = ("Anna Sthesia", "Paige Turner", "Bob Frapples") >>> users = mommy.make(UserProfile, _quantity=5, last_name=itertools.cycle(name_iterable)) >>> [u.last_name for u in users] ['Anna Sthesia', 'Paige Turner', 'Bob Frapples', 'Anna Sthesia', 'Paige Turner']
Is this a feature? If so, I think it should be documented here
Related issue: berinhard/model_mommy#81
Python: 3.7.1 Django: 2.2 Model Mommy: 1.6.0
The text was updated successfully, but these errors were encountered:
Hi, I am working on this issue. I have raised one PR here: #309
Please check it out and let me know if any changes are required.
Sorry, something went wrong.
Fixed by #309
No branches or pull requests
It is documented that recipes can have callables and iterators as value here
The source code looks like you can do the same thing when not using custom recipes but rather just
mommy.make(Class, **attrs)
:https://github.com/berinhard/model_mommy/blob/2f8948ce1d8ee5c29d097d1890bcf2811ef0e80c/model_mommy/mommy.py#L282 and
https://github.com/berinhard/model_mommy/blob/2f8948ce1d8ee5c29d097d1890bcf2811ef0e80c/model_mommy/mommy.py#L284
Also, using it works perfectly fine:
Is this a feature? If so, I think it should be documented here
Related issue: berinhard/model_mommy#81
Versions
Python: 3.7.1
Django: 2.2
Model Mommy: 1.6.0
The text was updated successfully, but these errors were encountered: