github model-bakers/model_bakery 1.24.2

5 hours ago

Changed

  • Fix reverse one-to-one recipes creating extra parent objects. Each parent gets a distinct related object, with nested recipe behavior preserved. Parent validation (with _full_clean=True) and save hooks run before the reverse object exists. With prepare(_save_related=True), reverse children remain unsaved; recipe preparation ignores creation-only options (#97).
  • Fix ValueError when using _fill_optional=True on a model with a ForeignKey/OneToOneField that has a default. The field's raw default (a pk) is now assigned via the attribute name (e.g. related_id) instead of the relation name, matching Django's own default-handling behavior.

💙 Thank you to our sponsors for supporting Model Bakery’s maintenance.

If Model Bakery saves you time, consider supporting it through GitHub Sponsors or Ko-fi. Your support helps fund bug fixes, reviews, and compatibility with new Django and Python versions.

Using Model Bakery at work? Tidelift offers an enterprise subscription that helps organizations manage the security, licensing, and maintenance of their open source dependencies while supporting maintainers.

Don't miss a new model_bakery release

NewReleases is sending notifications on new releases.