model_bakery icon indicating copy to clipboard operation
model_bakery copied to clipboard

Django 5 db_default field parameter ignored when creating recipies

Open majorgilles opened this issue 8 months ago • 0 comments

Describe the issue Model bakery seems to ignore the new django 5.+ field setting "db_default".

To Reproduce

  1. Original version of a field:
        null=False, default=20, help_text="In percentage (0-100)"
    )
  1. Switching to db_default:
        null=False, db_default=20, help_text="In percentage (0-100)"
    )
  1. Baked model using this field assigns a random positive integer value
  2. I have to explicitly set the value in the Recipe for it to work

Expected behavior db_default parameter should be used as default in the recipe just as former default parameter was used instead of a random int

Versions

  • Python: 3.11
  • Django: 5.0.6
  • Model Bakery: 1.18.0

majorgilles avatar Jun 10 '24 10:06 majorgilles