-
Notifications
You must be signed in to change notification settings - Fork 47
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
Make non-null fields required #36
Conversation
Hello everyone, I'm not sure that this is the right solution, however I'm pretty sure that this is a "real" problem. To sum it up, I would expect the following code to raise an
Currently it silently stores an unicode empty string ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While backward incompatible I feel like this is an issue that should be fixed.
src/picklefield/fields.py
Outdated
@@ -105,8 +105,7 @@ def get_default(self): | |||
if callable(self.default): | |||
return self.default() | |||
return self.default | |||
# If the field doesn't have a default, then we punt to models.Field. | |||
return super(PickledObjectField, self).get_default() | |||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the appropriate solution might be to set PickledObjectField.empty_strings_allowed = False
.
1a10d4f
to
0c6723c
Compare
@charettes - thanks for the quick reaction. I updated the code to use the proposed solution (the one with All the best. |
@cdman looking good! Do you think you could rebase on top of |
2d174aa
to
e8d52ee
Compare
@charettes - done. I'm a little un-easy about releasing such a breaking change in a minor version bump but it's your call 😄. |
e8d52ee
to
ef12aa3
Compare
ef12aa3
to
a349173
Compare
@cdman I rebased your branch for 2.0 which I plan to release today. |
74ea3e6
to
6313b66
Compare
That enforces the usage of `null=True` to store empty values.
6313b66
to
46e229e
Compare
No description provided.