34👍
Use factory.List:
class ParentOfUsers(factory.Factory):
users = factory.List([
factory.SubFactory(UserFactory) for _ in range(5)
])
👤Paul
5👍
You could provide a list with factory.Iterator
import itertools
import factory
# cycle through the same 5 users
users = itertools.cycle(
(UserFactory() for _ in range(5))
)
class ParentFactory(factory.Factory):
user = factory.Iterator(users)
- [Django]-AccessDenied when calling the CreateMultipartUpload operation in Django using django-storages and boto3
- [Django]-Django Admin app or roll my own?
- [Django]-Django: Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not found
Source:stackexchange.com