model-bakers / model_bakery

Object factory for Django
https://model-bakery.readthedocs.io/en/latest/
Other
846 stars 85 forks source link

Make TextField generator respect max_length #493

Closed SergeiJp closed 3 months ago

SergeiJp commented 3 months ago

The generator for TextField doesn't respect the max_length set in the model field. As a result, validating the model through the serializer causes a validation error.

Switch to use gen_string instead of gen_text which respect the max_length and also support MAX_LENGTH constant if max_length is not set on the field

PR Checklist

amureki commented 3 months ago

Released in 1.19.4