I am using django 1.6 and factory-boy.
class UserFactory(factory.Factory):
class Meta:
model = models.User
username = factory.Sequence(lambda n: 'user%d' % n)
Here username
is a simple CharField
in model. So that each time I am calling UserFactory()
I am saving and getting unique user named object.
In factory-boy I can use factory.SubFactory(SomeFactory)
.
How I can generate list of SomeFactory
in ParentOfSomeFactory
?
So that, if I call ParentOfSomeFactory()
I will create list of SomeFactory as well as ParentOfSomeFactory database
lambda
would return list? – Griner