model-bakers / model_bakery

Object factory for Django
https://model-bakery.readthedocs.io/en/latest/
Other
845 stars 85 forks source link

Use existing object by foreign_key relationship #448

Open egorgam opened 1 year ago

egorgam commented 1 year ago

Hello! I have data generation script based on model bakery recipes. When I use foreign_key, a new data is generating, and it brakes unique constraint in some cases. Can I create data by make_recipe, and use existing instance for making relations?