11
I'm currently using factory_boy for creating fixtures in my tests.
Factory_boy docs only mentioned about SubFactory which could act like a ForeignKey field in a model. However, there was nothing on ManyToMany association. If I had a following Post model, how would I go about creating a factory for it?
class Post(models.Model):
title = models.CharField(max_length=100)
tags = models.ManyToManyField('tags.Tag')
class PostFactory(factory.Factory):
FACTORY_FOR = Post
title = 'My title'
tags = ???