Skip to content

Django 5 db_default field parameter ignored when creating recipies #479

@majorgilles

Description

@majorgilles

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

Metadata

Metadata

Assignees

No one assigned

    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