Skip to content

_refresh_after_create option isn't documented #513

@paduszyk

Description

@paduszyk

Describe the issue

Baking a model with the post_save signal handler returns instance without the update by the handler (which in my case was populating some optional fields if not given).

By studying the codebase I found that the passing _refresh_after_create=True to baker.make fixes the problem.

Expected behavior

I think this functionality should be documented.

I did not find anything on https://model-bakery.readthedocs.io when using the search bar with "_refresh_after_create" query.

Alternatively, _refresh_after_create=True could be automatically set if the model is registered a sender of post_save. But this is the idea for another ticket, I guess.

Versions

  • Python: 3.13
  • Django 4.1.
  • Model Bakery 1.20.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions