# Model Bakery: Smart fixtures for better tests

Model Bakery offers you a smart way to create fixtures for testing in Django.

With a simple and powerful API, you can create many objects with a single line of code.

Model Bakery is a rename of the legacy model_mommy’s project. This is because the project’s creator and maintainers decided to not reinforce gender stereotypes for women in technology. You can read more about this subjecthere.

# Compatibility

Model Bakery supports Django >= 4.2.

# Install

Install it with `pip`

    $ pip install model-bakery

# Contributing to Model Bakery

As an open-source project, Model Bakery welcomes contributions of many forms. Examples of contributions include:

- Code Patches

- Documentation improvements

- Bug reports

Take a look in our GitHub repo for more instructions on how to set up your local environment to help Model Bakery to grow.

# Doubts? Loved it? Hated it? Suggestions?

Feel free to open an issue for support, development or ideas!

## Contents

- Basic Usage
  - Model Relationships
  - M2M Relationships
  - Explicit M2M Relationships
  - Explicit values for fields
  - Creating Files
  - Refreshing Instances After Creation
  - Non persistent objects
  - More than one instance
  - Multi-database support
- Recipes
  - Recipes with foreign keys
  - Recipes with callables
  - Recipes with iterators
  - Sequences in recipes
  - Overriding recipe definitions
  - Recipe inheritance
- How Model Bakery behaves?
  - When shouldn’t you let Baker generate things for you?
  - Currently supported fields
  - Custom fields
  - Customizing Baker
  - Save method custom parameters
- Test Runners
  - Django
  - pytest
- Migrating from Model Mommy