Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to create Url with model_bakery: too long pattern throws exception #132

Closed
PetrDlouhy opened this issue Aug 19, 2022 · 1 comment · Fixed by #133
Closed

Not able to create Url with model_bakery: too long pattern throws exception #132

PetrDlouhy opened this issue Aug 19, 2022 · 1 comment · Fixed by #133

Comments

@PetrDlouhy
Copy link
Contributor

PetrDlouhy commented Aug 19, 2022

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.

@tony
Copy link
Member

tony commented Sep 9, 2023

model_backery: GitHub, docs

@tony tony closed this as completed in #133 Dec 9, 2023
tony added a commit that referenced this issue Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants