If I try to create Url model with model_bakery without any parameters, I have got this error:
django.db.utils.DataError: value too long for type character varying(255)
The problem is, that pattern parameter (generated by model_bakery) gets lengthen in save() method by leading / and doesn't fit in the field anymore.
The solution is very simple: add default="" to the pattern field.
There is also second problem with the save method - if user enters pattern exactly 255 characters long in the admin, it will throw an exception rather than showing validation error.
If I try to create Url model with model_bakery without any parameters, I have got this error:
The problem is, that
pattern
parameter (generated by model_bakery) gets lengthen insave()
method by leading/
and doesn't fit in the field anymore.The solution is very simple: add
default=""
to the pattern field.There is also second problem with the save method - if user enters pattern exactly 255 characters long in the admin, it will throw an exception rather than showing validation error.