model-bakers / model_bakery

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

String generation fails on Django 4.2 for CharField(max_length=None) #407

Closed knyghty closed 1 year ago

knyghty commented 1 year ago

Describe the issue CharField can have max_length=None when using Postgres and Django 4.2+. model bakery isn't aware of this and will try to generate a string of length None. I suggest we add a check if max_length is None and if so, we just use a static range of 100 chars or so.

To Reproduce Try to generate a string when using CharField() with no max_length on Postgres.

Expected behavior I get some kind of string returned.

Versions