Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_refresh_after_create option isn't documented #513

Closed
paduszyk opened this issue Jan 1, 2025 · 1 comment
Closed

_refresh_after_create option isn't documented #513

paduszyk opened this issue Jan 1, 2025 · 1 comment
Assignees

Comments

@paduszyk
Copy link

paduszyk commented Jan 1, 2025

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
@amureki amureki self-assigned this Jan 5, 2025
@amureki
Copy link
Collaborator

amureki commented Jan 5, 2025

Greetings @paduszyk !
Thank you for this good catch! We indeed did not document this.

I did create a PR addressing this: #514

I'd be happy to get your review on it; otherwise I'll merge and release this next week with several other updates.

@amureki amureki closed this as completed in 0e49b20 Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants