berinhard/model_mommy

Custom fields using _quantity parameter

aipi opened this issue · 1 comments

aipi commented

At Python Brasil (http://www.youtube.com/watch?v=YUSBDFidPZ8&t=31m4s), @berinhard had commented that the use of _quantity with attribute parameters to instance a new object would be a feature and in that time someone created an issue for resolving it. Has it already been resolved? Does exist any way to make it?

I am thinking that would be something like this:

In [1]: from model_mommy import mommy

In [2]: kids = mommy.make('family.Kid', _quantity=3, name=['Richard', 'Maria', 'Ana'], age=9)

In [3]: [(kid.name, kid.age) for kid in kids]
Out[3]: [('Richard', 9), ('Maria', 9), ('Ana', 9)]

My question has been based because I don't find any documentation which informs it. If it has been already implemented, where could I find it?

@aipi this talk is pretty old and it was given before model mommy's sequence functionality. No model mommy works the way you described to us.