-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Dict field allow empty #6583
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
Dict field allow empty #6583
Conversation
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.
Aside from the requests, these changes seem sensible to me. That said, I'd like others to review.
tests/test_fields.py
Outdated
output = field.run_validation(None) | ||
assert output is None | ||
|
||
def test_allow_empty(self): |
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 would change the name to test_allow_empty_disallowed
(or similar), as test_allow_empty
implies allow_empty=True
.
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.
Ok, renamed
"Project-Id-Version: PACKAGE VERSION\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-07-12 16:13+0100\n" | ||
"POT-Creation-Date: 2019-04-11 23:21+0200\n" |
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.
Translations are managed with transifex and are updated via the release process. These changes should be removed.
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.
Ok, changes in this file have been dropped
Thank you for your review, I've applied the changes requested and rebased onto master. |
Looks spot on to me. |
* dict field: support allow_empty option * document ListField allow_empty option * document HStoreField allow_empty parameter
* dict field: support allow_empty option * document ListField allow_empty option * document HStoreField allow_empty parameter
* dict field: support allow_empty option * document ListField allow_empty option * document HStoreField allow_empty parameter
Description
This patch adds support for
allow_empty
option toDictField
andHStoreField
.Enforcing that the field value is not empty is a common use case in my opinion.
The same parameter was already supported by the other composite field
ListField
.Param defaults to
False
so current behaviour is not changed.