mixer icon indicating copy to clipboard operation
mixer copied to clipboard

Generate model instance with related data at once.

Open AlwxSin opened this issue 6 years ago • 0 comments

Thanks for the great library.

Is there an api to generate a model instance with several relations (OneToOne, ManyToOne, ManyToMany)? Like so:

user = mixer.blend(User)
    .with(Profile, 1)  # one profile
    .with(Post, 4)   # 4 posts
    .with(Comment, 20, post=mixer.mix.posts)  # 20 comments to previous posts

AlwxSin avatar Aug 27 '19 12:08 AlwxSin