Skip to content

Removed input value from deault_error_message #5881

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

Merged
merged 4 commits into from
Apr 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rest_framework/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def __repr__(self):

class BooleanField(Field):
default_error_messages = {
'invalid': _('"{input}" is not a valid boolean.')
'invalid': _('Must be a valid boolean.')
}
default_empty_html = False
initial = False
Expand Down Expand Up @@ -687,7 +687,7 @@ def to_representation(self, value):

class NullBooleanField(Field):
default_error_messages = {
'invalid': _('"{input}" is not a valid boolean.')
'invalid': _('Must be a valid boolean.')
}
initial = None
TRUE_VALUES = {
Expand Down Expand Up @@ -841,7 +841,7 @@ class UUIDField(Field):
valid_formats = ('hex_verbose', 'hex', 'int', 'urn')

default_error_messages = {
'invalid': _('"{value}" is not a valid UUID.'),
'invalid': _('Must be a valid UUID.'),
}

def __init__(self, **kwargs):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ class TestBooleanField(FieldValues):
False: False,
}
invalid_inputs = {
'foo': ['"foo" is not a valid boolean.'],
'foo': ['Must be a valid boolean.'],
None: ['This field may not be null.']
}
outputs = {
Expand All @@ -598,7 +598,7 @@ def test_disallow_unhashable_collection_types(self):
for input_value in inputs:
with pytest.raises(serializers.ValidationError) as exc_info:
field.run_validation(input_value)
expected = ['"{0}" is not a valid boolean.'.format(input_value)]
expected = ['Must be a valid boolean.'.format(input_value)]
assert exc_info.value.detail == expected


Expand All @@ -615,7 +615,7 @@ class TestNullBooleanField(TestBooleanField):
None: None
}
invalid_inputs = {
'foo': ['"foo" is not a valid boolean.'],
'foo': ['Must be a valid boolean.'],
}
outputs = {
'true': True,
Expand Down Expand Up @@ -759,8 +759,8 @@ class TestUUIDField(FieldValues):
284758210125106368185219588917561929842: uuid.UUID('d63a6fb6-88d5-40c7-a91c-9edf73283072')
}
invalid_inputs = {
'825d7aeb-05a9-45b5-a5b7': ['"825d7aeb-05a9-45b5-a5b7" is not a valid UUID.'],
(1, 2, 3): ['"(1, 2, 3)" is not a valid UUID.']
'825d7aeb-05a9-45b5-a5b7': ['Must be a valid UUID.'],
(1, 2, 3): ['Must be a valid UUID.']
}
outputs = {
uuid.UUID('825d7aeb-05a9-45b5-a5b7-05df87923cda'): '825d7aeb-05a9-45b5-a5b7-05df87923cda'
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy