Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/how_bakery_behaves.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Require `django.contrib.gis` in `INSTALLED_APPS`:

Model Bakery allows you to define generators methods for your custom fields or overrides its default generators.
This can be achieved by specifying the field and generator function for the `generators.add` function.
It can also be done by specifying the field and generator function in the `BAKER_CUSTOM_FIELDS_GEN` setting.
Both can be the real python objects imported in settings or just specified as import path string.

Examples:
Expand All @@ -78,6 +79,13 @@ from model_bakery import baker
baker.generators.add('test.generic.fields.CustomField', 'code.path.gen_func')
```

```python
# in your settings.py file:
BAKER_CUSTOM_FIELDS_GEN = {
'test.generic.fields.CustomField': 'code.path.gen_func',
}
```

## Customizing Baker

In some rare cases, you might need to customize the way Baker base class behaves.
Expand Down