klen / mixer

Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.
Other
944 stars 95 forks source link

Skip Django related models generation when primary key is provided #28

Open DXist opened 9 years ago

DXist commented 9 years ago

It would be nice to skip generation of related Django model when related key is provided. Example:

class Author(models.Model):
    ... 

class Book(models.Model):
      author = models.ForeignKey(Author)
       ...
# don't generate extra author instance
mixer.blend(Book, author_id=3)

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/6290149-skip-django-related-models-generation-when-primary-key-is-provided?utm_campaign=plugin&utm_content=tracker%2F327725&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F327725&utm_medium=issues&utm_source=github).